You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The callback to `browserstackRunner.run` is called with two params -
61
+
61
62
-`error`: This parameter is either `null` or an `Error` object (if test execution failed) with message as the reason of why executing the tests on `BrowserStack` failed.
62
63
-`report`: This is an array which can be used to keep track of the executed tests and suites in a run. Each object in the array has the following keys -
63
64
-`browser`: The name of the browser the test executed on.
@@ -74,10 +75,7 @@ The structure of the `report` object is as follows -
74
75
{
75
76
"name": "isOdd()",
76
77
"suiteName": "Odd Tests",
77
-
"fullName": [
78
-
"Odd Tests",
79
-
"isOdd()"
80
-
],
78
+
"fullName": ["Odd Tests", "isOdd()"],
81
79
"status": "passed",
82
80
"runtime": 2,
83
81
"errors": [],
@@ -108,18 +106,13 @@ The structure of the `report` object is as follows -
108
106
"childSuites": [
109
107
{
110
108
"name": "Odd Tests",
111
-
"fullName": [
112
-
"Odd Tests"
113
-
],
109
+
"fullName": ["Odd Tests"],
114
110
"childSuites": [],
115
111
"tests": [
116
112
{
117
113
"name": "isOdd()",
118
114
"suiteName": "Odd Tests",
119
-
"fullName": [
120
-
"Odd Tests",
121
-
"isOdd()"
122
-
],
115
+
"fullName": ["Odd Tests", "isOdd()"],
123
116
"status": "passed",
124
117
"runtime": 2,
125
118
"errors": [],
@@ -181,17 +174,17 @@ To run browser tests on BrowserStack infrastructure, you need to create a `brows
*`test_path`: Path to the test page which will run the tests when opened in a browser.
187
-
*`test_framework`: Specify test framework which will run the tests. Currently supporting qunit, jasmine, jasmine1.3.1, jasmine2 and mocha.
188
-
*`test_server_port`: Specify test server port that will be opened from BrowserStack. If not set the default port 8888 will be used. Find a [list of all supported ports on browerstack.com](https://www.browserstack.com/question/664).
189
-
*`timeout`: Specify worker timeout with BrowserStack.
190
-
*`browsers`: A list of browsers on which tests are to be run. Find a [list of all supported browsers and platforms on browerstack.com](https://www.browserstack.com/list-of-browsers-and-platforms?product=js_testing).
191
-
*`build`: A string to identify your test run in Browserstack. In `TRAVIS` setup `TRAVIS_COMMIT` will be the default identifier.
192
-
*`proxy`: Specify a proxy to use for the local tunnel. Object with `host`, `port`, `username` and `password` properties.
193
-
*`exit_with_fail`: If set to true the cli process will exit with fail if any of the tests failed. Useful for automatic build systems.
194
-
*`tunnel_pid_file`: Specify a path to file to save the tunnel process id into. Can also by specified using the `--pid` flag while launching browserstack-runner from the command line.
-`test_path`: Path to the test page which will run the tests when opened in a browser.
180
+
-`test_framework`: Specify test framework which will run the tests. Currently supporting qunit, jasmine, jasmine1.3.1, jasmine2 and mocha.
181
+
-`test_server_port`: Specify test server port that will be opened from BrowserStack. If not set the default port 8888 will be used. Find a [list of all supported ports on browerstack.com](https://www.browserstack.com/question/664).
182
+
-`timeout`: Specify worker timeout with BrowserStack.
183
+
-`browsers`: A list of browsers on which tests are to be run. Find a [list of all supported browsers and platforms on browerstack.com](https://www.browserstack.com/list-of-browsers-and-platforms?product=js_testing).
184
+
-`build`: A string to identify your test run in Browserstack. In `TRAVIS` setup `TRAVIS_COMMIT` will be the default identifier.
185
+
-`proxy`: Specify a proxy to use for the local tunnel. Object with `host`, `port`, `username` and `password` properties.
186
+
-`exit_with_fail`: If set to true the cli process will exit with fail if any of the tests failed. Useful for automatic build systems.
187
+
-`tunnel_pid_file`: Specify a path to file to save the tunnel process id into. Can also by specified using the `--pid` flag while launching browserstack-runner from the command line.
195
188
196
189
A sample configuration file:
197
190
@@ -232,32 +225,35 @@ A sample configuration file:
232
225
`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.
233
226
234
227
Example:
228
+
235
229
```json
236
230
{
237
-
"browser": "ie",
238
-
"browser_version": "10.0",
239
-
"os": "Windows",
240
-
"os_version": "8",
241
-
"cli_key": 1
231
+
"browser": "ie",
232
+
"browser_version": "10.0",
233
+
"os": "Windows",
234
+
"os_version": "8",
235
+
"cli_key": 1
242
236
}
243
237
```
244
238
245
239
For mobile platforms, `os`, `os_version` and `device` parameters are required.
246
240
247
241
Example:
242
+
248
243
```json
249
-
[{
250
-
"os": "ios",
251
-
"os_version": "8.3",
252
-
"device": "iPhone 6 Plus",
253
-
"cli_key": 1
254
-
},
255
-
{
256
-
"os": "android",
257
-
"os_version": "4.0",
258
-
"device": "Google Nexus",
259
-
"cli_key": 2
260
-
}
244
+
[
245
+
{
246
+
"os": "ios",
247
+
"os_version": "8.3",
248
+
"device": "iPhone 6 Plus",
249
+
"cli_key": 1
250
+
},
251
+
{
252
+
"os": "android",
253
+
"os_version": "4.0",
254
+
"device": "Google Nexus",
255
+
"cli_key": 2
256
+
}
261
257
]
262
258
```
263
259
@@ -266,48 +262,52 @@ For a full list of supported browsers, platforms and other details, [visit the B
266
262
#### Compact `browsers` configuration
267
263
268
264
When `os` and `os_version` granularity is not desired, following configuration can be used:
269
-
*`[browser]_current` or *browser*_latest: will assign the latest version of the *browser*.
270
-
*`[browser]_previous`: will assign the previous version of the *browser*.
271
-
*`[browser]_[version]`: will assign the *version* specified of the *browser*. Minor versions can be concatenated with underscores.
265
+
266
+
-`[browser]_current` or _browser_\_latest: will assign the latest version of the _browser_.
267
+
-`[browser]_previous`: will assign the previous version of the _browser_.
268
+
-`[browser]_[version]`: will assign the _version_ specified of the _browser_. Minor versions can be concatenated with underscores.
272
269
273
270
This can also be mixed with fine-grained configuration.
274
271
275
272
Example:
273
+
276
274
```json
277
275
{
278
276
"browsers": [
279
-
"chrome_previous",
280
-
"chrome_latest",
281
-
"firefox_previous",
282
-
"firefox_latest",
283
-
"ie_6",
284
-
"ie_11",
285
-
"opera_12_1",
286
-
"safari_5_1",
287
-
{
288
-
"browser": "ie",
289
-
"browser_version": "10.0",
290
-
"device": null,
291
-
"os": "Windows",
292
-
"os_version": "8",
293
-
"cli_key": 1
294
-
}
277
+
"chrome_previous",
278
+
"chrome_latest",
279
+
"firefox_previous",
280
+
"firefox_latest",
281
+
"ie_6",
282
+
"ie_11",
283
+
"opera_12_1",
284
+
"safari_5_1",
285
+
{
286
+
"browser": "ie",
287
+
"browser_version": "10.0",
288
+
"device": null,
289
+
"os": "Windows",
290
+
"os_version": "8",
291
+
"cli_key": 1
292
+
}
295
293
]
296
294
}
297
295
```
296
+
298
297
**Note:**
299
298
These shortcuts work only for browsers on desktop platforms supported by BrowserStack.
300
299
301
300
### Proxy support for BrowserStack local
302
301
303
302
Add the following in `browserstack.json`
303
+
304
304
```json
305
305
{
306
306
"proxy": {
307
-
"host": "localhost",
308
-
"port": 3128,
309
-
"username": "foo",
310
-
"password": "bar"
307
+
"host": "localhost",
308
+
"port": 3128,
309
+
"username": "foo",
310
+
"password": "bar"
311
311
}
312
312
}
313
313
```
@@ -316,19 +316,18 @@ Add the following in `browserstack.json`
316
316
317
317
To avoid duplication of system or user specific information across several configuration files, use these environment variables:
318
318
319
-
*`BROWSERSTACK_USERNAME`: BrowserStack user name.
320
-
*`BROWSERSTACK_KEY`: BrowserStack key.
321
-
*`TUNNEL_ID`: Identifier for the current instance of the tunnel process. In `TRAVIS` setup `TRAVIS_JOB_ID` will be the default identifier.
322
-
*`BROWSERSTACK_JSON`: Path to the browserstack.json file. If null, `browserstack.json` in the root directory will be used.
323
-
319
+
-`BROWSERSTACK_USERNAME`: BrowserStack user name.
320
+
-`BROWSERSTACK_KEY`: BrowserStack key.
321
+
-`TUNNEL_ID`: Identifier for the current instance of the tunnel process. In `TRAVIS` setup `TRAVIS_JOB_ID` will be the default identifier.
322
+
-`BROWSERSTACK_JSON`: Path to the browserstack.json file. If null, `browserstack.json` in the root directory will be used.
323
+
-`BROWSERSTACK_LOCAL_BINARY_PATH`: Path to the browserstack local binary present on the system. If null, `BrowserStackLocal` in the `lib/` directory will be used.
324
324
325
325
### Secure Information
326
326
327
327
To avoid checking in the BrowserStack `username` and `key` in your source control system, the corresponding environment variables can be used.
328
328
329
329
These can also be provided by a build server, for example [using secure environment variables on Travis CI](http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables).
330
330
331
-
332
331
### Code Sample
333
332
334
333
Check out code sample [here](https://github.com/browserstack/browserstack-runner-sample).
@@ -348,11 +347,12 @@ To run a larger suite of tests ensuring compatibility with older versions of QUn
348
347
Tests are also run for every pull request, courtesy [Travis CI](https://travis-ci.org/).
349
348
350
349
### Timeout issue with Travis CI
351
-
352
-
You might face [build timeout issue on Travis](https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received) if runner takes more than 10 minutes to run tests.
353
350
354
-
There are 2 possible ways to solve this problem:
355
-
1. Run a script which does `console.log` every 1-2 minutes. This will output to console and hence avoid Travis build timeout
356
-
2. Use `travis_wait` function provided by Travis-CI. You can prefix `browserstack-runner` command by `travis-wait` in your `travis.yml` file
351
+
You might face [build timeout issue on Travis](https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received) if runner takes more than 10 minutes to run tests.
352
+
353
+
There are 2 possible ways to solve this problem:
354
+
355
+
1. Run a script which does `console.log` every 1-2 minutes. This will output to console and hence avoid Travis build timeout
356
+
2. Use `travis_wait` function provided by Travis-CI. You can prefix `browserstack-runner` command by `travis-wait` in your `travis.yml` file
357
357
358
358
We would recommend using `travis_wait` function. It also allows you to configure wait time (ex: `travis_wait 20 browserstack-runner`, this will extend wait time to 20 minutes). Read more about `travis_wait`[here](https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received)
0 commit comments