Skip to content

Commit 3244eb8

Browse files
committed
updated readme with new commands/options
1 parent cb6eef2 commit 3244eb8

1 file changed

Lines changed: 61 additions & 4 deletions

File tree

README.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ $ webpagetest --help
5353
* **testinfo** _\<id\>_: get test request info/details
5454
* **waterfall** _[options] \<id\>_: get the waterfall PNG image
5555
* **screenshot** _[options] \<id\>_: get the fully loaded page screenshot in JPG format (PNG if in full resolution)
56-
* **listen** _[port]_: start webpagetest-api server on port [7791]
56+
* **listen** _[port]_: start webpagetest-api server on port _[7791_]
57+
* **batch** _\<file\>_: run commands in batch, i.e. one command per line from _\<file\>_ in parallel
5758

5859
### Options
5960

@@ -110,15 +111,17 @@ _The default WPT server can also be specified via environment variable `WEBPAGET
110111
* **-Q, --noparser**: disable threaded HTML parser (Chrome only)
111112
* **-q, --spdynossl**: use SPDY without SSL (Chrome only)
112113
* **--cmdline** _\<switches\>_: use a list of custom command line switches (Chrome only)
113-
* **--poll** _[interval]_: poll for results after test is scheduled at every <interval> seconds [5]
114-
* **--wait** _[hostname:port]_: wait for test results informed by agent once complete listening on <hostname>:<port> [hostname:first port available above 8000]
114+
* **--poll** _[interval]_: poll for results after test is scheduled at every \<interva\l> seconds [5]
115+
* **--wait** _[hostname:port]_: wait for test results informed by agent once complete listening on \<hostname\>:\<port\> [hostname:first port available above 8000]
115116
* **--timeout** _\<seconds\>_: timeout for polling and waiting results [no timeout]
116117

117118
#### Request (works for **status**, **results**, **locations**, **testers** and **test** commands)
118119
* **-e, --request** _\<id\>_: echo request ID, useful to track asynchronous requests
119120

120121
#### Results (works for **results** and **test** commands)
121-
* **-m, --median** _\<metric\>_: set the metric used to calculate median for multiple runs tests [loadTime]
122+
* **--median** _\<metric\>_: set the metric used to calculate median for multiple runs tests [loadTime]
123+
* **--specs** _\<json_or_file\>_: set the specs for performance test suite
124+
* **--reporter** _\<name\>_: set performance test suite reporter output: [dot]|spec|tap|xunit|list|progress|min|nyan|landing|json|doc|markdown|teamcity
122125

123126
#### Run (works for **pagespeed**, **utilization**, **request**, **timeline**, **netlog**, **console**, **waterfall** and **screenshot** commands)
124127
* **-r, --run** _\<number\>_: which run number on a multiple runs test [1]
@@ -409,6 +412,8 @@ wpt.runTest(script, function(err, data) {
409412

410413
#### Results (works for **getResults** and **runTest** methods)
411414
* **medianMetric**: _String_, set the metric used to calculate median for multiple runs tests (default: loadTime)
415+
* **specs**: _String_, set the specs for performance test suite
416+
* **reporter**: _String_, set performance test suite reporter output: [dot]|spec|tap|xunit|list|progress|min|nyan|landing|json|doc|markdown|teamcity
412417

413418
#### Run (works for `getPageSpeedData`, `getUtilizationData`, `getRequestData`, `getTimelineData`, `getNetLogData`, `getConsoleLogData`, `getWaterfallImage` and `getScreenshotImage` methods)
414419
* **run**: _Number_, the test run number for multiple runs tests (default: 1, first test)
@@ -534,13 +539,65 @@ setTimeout(function() {
534539
}, 10000); // wait for 10s before stop listening
535540
```
536541

542+
## Batch
543+
Batch command is available as command line only and loads a batch file containing one WebPageTest CLI command with options per line. It runs all commands in paralell but returns and array of results in order as they appear in the batch file once all results are ready. The exit status code is the sum of all individual commands exit status code.
544+
545+
By running
546+
```bash
547+
$ webpagetest batch commands.txt
548+
```
549+
where `commands.txt` contains:
550+
```
551+
test twitter.com/marcelduran --first --location foo
552+
test twitter.com/marcelduran --first --location bar
553+
```
554+
It schedules the 2 tests above returning an array of size 2 in the same order as in `commands.txt` file:
555+
```javascript
556+
[
557+
{
558+
"statusCode": 200, "statusText": "Ok",
559+
"data": {
560+
"testId": "130715_AB_C1D",
561+
...
562+
}
563+
},
564+
{
565+
"statusCode": 200, "statusText": "Ok",
566+
"data": {
567+
"testId": "130715_CD_E2F",
568+
...
569+
}
570+
}
571+
]
572+
```
573+
With exit status 0 in case none of commands returns an error:
574+
```bash
575+
$ echo $?
576+
0
577+
````
578+
579+
By running multiple sync tests, i.e. with either `--poll` or `--wait`, all tests are schedule and results are pulled or wait in paralell, it means if tests are set to run in different locations of same location with multiple agents, the final result might come together but the result array will only return once all tests are done. e.g.:
580+
581+
`commands.txt`:
582+
```
583+
test twitter.com/marcelduran --first --location foo --poll --timeout 60
584+
test twitter.com/marcelduran --first --location bar --poll --timeout 60
585+
```
586+
587+
## Test Specs (Continuous Integration)
588+
589+
WebPageTest API Wrapper provides a simple seamless way to integrate WebPageTest with Continuous Integration tools.
590+
591+
[See dedicated page](https://github.com/marcelduran/webpagetest-api/wiki/Test-Specs)
592+
537593
## Tests
538594
```bash
539595
$ npm test
540596
```
541597

542598
## Changelog
543599

600+
* 0.1.0: Specs (CI); Run in batch; Node methods/options as command aliases; new Chrome test options
544601
* 0.0.4: Sync test with results via `--poll` or `--wait`
545602
* 0.0.3: Custom test results median metric; Custom waterfall; new Chrome test options
546603
* 0.0.2: Minor bugs; 2 new commands: testers and testinfo

0 commit comments

Comments
 (0)