Skip to content

Commit abe1ea6

Browse files
committed
Update the docs
1 parent bfbefca commit abe1ea6

File tree

1 file changed

+66
-41
lines changed

1 file changed

+66
-41
lines changed

help_docs/customizing_test_runs.md

Lines changed: 66 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -169,56 +169,26 @@ Or the short form:
169169
sbase options
170170
```
171171

172-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Customizing default settings:</h3>
172+
--------
173173

174-
An easy way to override [seleniumbase/config/settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) is by using a custom settings file.
175-
Here's the command-line option to add to tests: (See [examples/custom_settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/custom_settings.py))
176-
``--settings-file=custom_settings.py``
177-
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
174+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Combinations:</h3>
178175

179-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests on a remote Selenium Grid:</h3>
176+
There are times when you'll want to combine various command-line options for added effect.
177+
For instance, the multi-process option, ``-n=4``, can be customized by adding:
178+
``--dist=loadscope`` or ``--dist=loadfile`` to it.
179+
Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/pytest-xdist/):
180180

181-
SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, [TestingBot](https://testingbot.com/features)'s Selenium Grid, other Grids, and even your own Grid:
181+
* ``-n=4 --dist=loadscope``: Tests are grouped by module for test functions and by class for test methods. Groups are distributed to available workers as whole units. This guarantees that all tests in a group run in the same process. This can be useful if you have expensive module-level or class-level fixtures. Grouping by class takes priority over grouping by module.
182182

183-
(For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities)
183+
* ``-n=4 --dist=loadfile``: Tests are grouped by their containing file. Groups are distributed to available workers as whole units. This guarantees that all tests in a file run in the same worker.
184184

185-
Here's how to connect to a BrowserStack Selenium Grid server for running tests:
185+
You might also want to combine multiple different options at once. For example:
186186

187187
```bash
188-
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
188+
pytest -n=4 --reuse-session --headless -v --dashboard --html=report.html
189189
```
190190

191-
Here's how to connect to a Sauce Labs Selenium Grid server for running tests:
192-
193-
```bash
194-
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
195-
```
196-
197-
Here's how to connect to a TestingBot Selenium Grid server for running tests:
198-
199-
```bash
200-
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
201-
```
202-
203-
Here's how to connect to a CrossBrowserTesting Selenium Grid server for running tests:
204-
205-
```bash
206-
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
207-
```
208-
209-
Here's how to connect to a LambdaTest Selenium Grid server for running tests:
210-
211-
```bash
212-
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
213-
```
214-
215-
Or you can create your own Selenium Grid for test distribution. ([See this ReadMe for details](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md))
216-
217-
To use a server on the ``https`` protocol, add ``--protocol=https``:
218-
219-
```bash
220-
pytest test_suite.py --protocol=https --server=IP_ADDRESS --port=PORT
221-
```
191+
The above not only runs tests in parallel processes, but it also tells tests in the same process to share the same browser session, runs the tests in headless mode, displays the full name of each test on a separate line, creates a realtime dashboard of the test results, and creates a full report after all tests complete.
222192

223193
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Example tests using Logging:</h3>
224194

@@ -350,6 +320,61 @@ nosetests test_suite.py --report
350320

351321
--------
352322

323+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Customizing default settings:</h3>
324+
325+
An easy way to override [seleniumbase/config/settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) is by using a custom settings file.
326+
Here's the command-line option to add to tests: (See [examples/custom_settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/custom_settings.py))
327+
``--settings-file=custom_settings.py``
328+
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
329+
330+
--------
331+
332+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests on a remote Selenium Grid:</h3>
333+
334+
SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, [TestingBot](https://testingbot.com/features)'s Selenium Grid, other Grids, and even your own Grid:
335+
336+
(For setting browser desired capabilities while running Selenium remotely, see the ReadMe located here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities)
337+
338+
Here's how to connect to a BrowserStack Selenium Grid server for running tests:
339+
340+
```bash
341+
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
342+
```
343+
344+
Here's how to connect to a Sauce Labs Selenium Grid server for running tests:
345+
346+
```bash
347+
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
348+
```
349+
350+
Here's how to connect to a TestingBot Selenium Grid server for running tests:
351+
352+
```bash
353+
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
354+
```
355+
356+
Here's how to connect to a CrossBrowserTesting Selenium Grid server for running tests:
357+
358+
```bash
359+
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
360+
```
361+
362+
Here's how to connect to a LambdaTest Selenium Grid server for running tests:
363+
364+
```bash
365+
pytest my_first_test.py --server=USERNAME:[email protected] --port=80
366+
```
367+
368+
Or you can create your own Selenium Grid for test distribution. ([See this ReadMe for details](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md))
369+
370+
To use a server on the ``https`` protocol, add ``--protocol=https``:
371+
372+
```bash
373+
pytest test_suite.py --protocol=https --server=IP_ADDRESS --port=PORT
374+
```
375+
376+
--------
377+
353378
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Using a Proxy Server:</h3>
354379

355380
If you wish to use a proxy server for your browser tests (Chromium or Firefox), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command line.

0 commit comments

Comments
 (0)