Batch Processing Command-line tool

Tool introduction

This command-line tool performs simple one-off batch testing. It loads the set of URLs in the input file as a batch, submits all of them to WebPageTest server which performs the tests, and then downloads the results of the successful tests and reports the failing tests. This tool is mainly implemented by the APIs in our batch processing library and hence can also serves as a sample usage of the batch processing APIs.

Usage description

Usage: [options]


  -h, --help    
  show this help message and exit
  -s SERVER, --server=SERVER    
  The wpt server URL. The default value is "" which is the public instance but will require an API key.
  -i URLFILE, --urlfile=URLFILE     
  The path of the input URL file (each line of the file should be a http URL like "".
  -f OUTPUTDIR, --outputdir=OUTPUTDIR    
  The path of the output directory where you want to save the testing results. The default value is a subdirectory called "result" under the current directory. The testing result file is named by url_wpt-test-id.xml.
  Set the connectivity to pre-defined type: DSL, Dial, Fios and custom (case sensitive). When it is custom, you can set the customized connectivity using the options -u/d/l/p below.

  -u BWUP, --bwup=BWUP  
  Upload bandwidth (unit: kbps) of the test.The default value is 1500 (i.e., 1.5Mbps).
  -d BWDOWN, --bwdown=BWDOWN    
  Download bandwidth (unit: kbps) of the test. The default value is 384.

  -l LATENCY, --latency=LATENCY    
  RTT (unit: ms) of the test.

  -p PLR, --plr=PLR     
  Packet loss (percentage) rate of the test. The default value is 0. 

  -v FVONLY, --fvonly=FVONLY    
  First view only. The repeat view is usually is used to test cache. The default value is True.

  -t, --tcpdump         
  Enable tcpdump. The default value is False.

  -c SCRIPT, --script=SCRIPT    
  Hosted script file

  -r RUNS, --runs=RUNS  
  The number of runs per test. The default value is 9.

  -o LOCATION, --location=LOCATION    
  Test location. The default location is from Dulles

  -m MV, --mv=MV        
  Video only saved for the median run. The default value is 1.

Usage examples

The batch test with all default setup 

This test uses all default configurations. The script reads the ./urls.txt file, submits all of them to http://latencylab WPT server and saves the results (in XML format) in the directory ./result. All the tests are repeated 9 times with DSL connection without packet loss

The batch test with user-specified input file, connectivity condition and number of runs

 ./ --urlfile=/foo/bar/urls.txt --runs=3 --connectivity=custom --bwup=384 --bwdown=1500 --latency=100 --plr=1
This test loads the URLs from /foo/bar/urls.txt. All the tests are repeated 3 times with 384kbps upload bandwidth, 1500kbps download bandwidth, 100ms round-trip time, and packet loss rate 1%.

The test with user-specified script which does account login

./ --urlfile=/foo/urls.txt --script=/foo/script.txt
The content of /foo/urls.txt:

The content of script.txt:
logData 0
// bring up the login screen
logData 1
// log in
setValue name=Email
setValue name=Passwd tester123=
submitForm id=gaia_loginform
The test uses the login information in the script to enter that gmail account and the result shows the latency of the after-login page gotten loaded.