Developer FAQ

This page contains questions asked by developers as they come up to speed on the code.  Feel free to add questions and improve answers.

Q: What is the 'key' parameter sent by wptdriver when it requests work?
A: The key is a shared secret between the driver on the agent and the server.  It needs to be configurable on the client.  In the windows client, it is configurable by adding the following lines to wptdriver.ini:
[WebPagetest]
key=VALUE

Q: How does the agents get work from the server?
A: The test agents call "webpagetest.org/work/getwork.php?location-=<location-id>&key=<key-secret>" to get work for its location. The server returns a line-separated set of "key=value" pairs, which contains various configuration parameters required for the test. The very critical parameter for the test is "url=<url-to-test".
e.g. 
request:
http://staging.webpagetest.org/work/getwork.php?location=Dev_Sadeesh

response:
Test ID=111006_2K_WF
url=http://www.google.com
runs=1
browser=Chrome
pngScreenShot=1
Adding &f=json to the URL gives the same information formatted as JSON:
{
  "Test ID": "111006_2K_WF",
  "url": "http://www.google.com",
  "runs": 1,
  "browser": "Chrome",
  "pngScreenShot" 1
}
Q: How does the agents post the results back to the server?
A: Once the page-load numbers are calculated, the results file is written to local disk in a file named as <num_run>_IEWPG.txt where num_run is the test run number. Then file is zipped into a zip-file named "results.zip" and posted (HTTP POST) along with other parameters like id, done (which is true after test is done), location and key.

Q: The server returns a blank or incomplete page with no errors.  What's going on?
A: The "error_reporting(0)" command in www/common.inc is used to disable error reporting to improve user experience in production.  If you want to see errors, add the "debug" parameter to your URL.


Comments