Skip to content

Commit 843c2cf

Browse files
authored
Updated Readme for CLI changes.
1 parent e026e81 commit 843c2cf

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ If you're getting an error `EACCES open ... BrowserStackLocal`, configure npm to
2525

2626
Where `[user]` is replaced with a local user with enough permissions.
2727

28+
CLI options:
29+
30+
`--path`: Can be used if a different test runner is needed other than the one present in the `browserstack.json` file.
31+
32+
`--pid`: Custom `pid` file that stores the pid's of the BrowserStackLocal instances created.
33+
34+
`--verbose` or `-v`: For verbose logging.
35+
36+
`--browsers` or `-b`: Space separated list of `cli_key` as defined in the `browserstack.json` file. This will run tests on the selected browsers only. If not present tests will run on all browsers present in the configuration file.
37+
38+
Sample Usage:
39+
`browserstack_runner --browsers 1 2 3 --path 'path/to/test/runner' --pid 'path/to/pid/file' -v`
40+
2841
## Usage as a module
2942

3043
`browserstack-runner` can also be used as a module. To run your tests, inside your project do -
@@ -160,7 +173,11 @@ The structure of the `report` object is as follows -
160173

161174
To run browser tests on BrowserStack infrastructure, you need to create a `browserstack.json` file in project's root directory (the directory from which tests are run), by running this command:
162175

163-
browserstack-runner init
176+
`browserstack-runner init [preset] [path]`
177+
178+
`preset`: Path of a custom preset file. Default: `presets/default.json`
179+
180+
`path`: Path to test file. Default: `path/to/test/runner`
164181

165182
### Parameters for `browserstack.json`
166183

@@ -191,33 +208,37 @@ A sample configuration file:
191208
"browser_version": "10.0",
192209
"device": null,
193210
"os": "Windows",
194-
"os_version": "8"
211+
"os_version": "8",
212+
"cli_key": 1
195213
},
196214
{
197215
"os": "android",
198216
"os_version": "4.0",
199-
"device": "Samsung Galaxy Nexus"
217+
"device": "Samsung Galaxy Nexus",
218+
"cli_key": 2
200219
},
201220
{
202221
"os": "ios",
203222
"os_version": "7.0",
204-
"device": "iPhone 5S"
223+
"device": "iPhone 5S",
224+
"cli_key": 3
205225
}
206226
]
207227
}
208228
```
209229

210230
#### `browsers` parameter
211231

212-
`browsers` parameter is a list of objects, where each object contains the details of the browsers on which you want to run your tests. This object differs for browsers on desktop platforms and browsers on mobile platforms. Browsers on desktop platform should contain `browser`, `browser_version`, `os `, `os_version` parameters set as required.
232+
`browsers` parameter is a list of objects, where each object contains the details of the browsers on which you want to run your tests. This object differs for browsers on desktop platforms and browsers on mobile platforms. Browsers on desktop platform should contain `browser`, `browser_version`, `os`, `os_version` parameters set as required and the `cli_key` parameter is optional and can be used in the command line when tests need to be run on a set of browsers from the `browserstack.json` file.
213233

214234
Example:
215235
```json
216236
{
217237
"browser": "ie",
218238
"browser_version": "10.0",
219239
"os": "Windows",
220-
"os_version": "8"
240+
"os_version": "8",
241+
"cli_key": 1
221242
}
222243
```
223244

@@ -228,12 +249,14 @@ Example:
228249
[{
229250
"os": "ios",
230251
"os_version": "8.3",
231-
"device": "iPhone 6 Plus"
252+
"device": "iPhone 6 Plus",
253+
"cli_key": 1
232254
},
233255
{
234256
"os": "android",
235257
"os_version": "4.0",
236-
"device": "Google Nexus"
258+
"device": "Google Nexus",
259+
"cli_key": 2
237260
}
238261
]
239262
```
@@ -266,7 +289,8 @@ Example:
266289
"browser_version": "10.0",
267290
"device": null,
268291
"os": "Windows",
269-
"os_version": "8"
292+
"os_version": "8",
293+
"cli_key": 1
270294
}
271295
]
272296
}

0 commit comments

Comments
 (0)