Skip to content

Commit 69cb278

Browse files
committed
Update the docs
1 parent abe1ea6 commit 69cb278

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

help_docs/customizing_test_runs.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,29 +171,12 @@ sbase options
171171

172172
--------
173173

174-
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Combinations:</h3>
175-
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/):
180-
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.
182-
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.
184-
185-
You might also want to combine multiple different options at once. For example:
186-
187-
```bash
188-
pytest -n=4 --reuse-session --headless -v --dashboard --html=report.html
189-
```
190-
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.
192-
193174
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Example tests using Logging:</h3>
194175

176+
To see logging abilities, you can run a test suite that includes tests that fail on purpose:
177+
195178
```bash
196-
pytest test_suite.py --browser=chrome
179+
pytest test_suite.py
197180
```
198181

199182
🔵 During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is specified (or if ARCHIVE_EXISTING_LOGS is set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py)), test logs will also get archived to the ``archived_logs/`` folder. Otherwise, the log files will be cleaned out when the next test run begins (by default).
@@ -218,7 +201,7 @@ If you want to pass additional data from the command line to your tests, you can
218201

219202
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Running tests multithreaded:</h3>
220203

221-
To run Pytest multithreaded on multiple CPUs at the same time, add ``-n=NUM`` or ``-n NUM`` on the command line, where NUM is the number of CPUs you want to use.
204+
To run pytest tests using multiple processes, add ``-n=NUM`` or ``-n NUM`` on the command line, where NUM is the number of CPUs you want to use.
222205

223206
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Retrying failing tests automatically:</h3>
224207

@@ -246,6 +229,25 @@ pytest my_first_test.py --pdb -s
246229

247230
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
248231

232+
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="28" /> Combinations of options:</h3>
233+
234+
There are times when you'll want to combine various command-line options for added effect.
235+
For instance, the multi-process option, ``-n=4``, can be customized by adding:
236+
``--dist=loadscope`` or ``--dist=loadfile`` to it.
237+
Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/pytest-xdist/):
238+
239+
* ``-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.
240+
241+
* ``-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.
242+
243+
You might also want to combine multiple options at once. For example:
244+
245+
```bash
246+
pytest -n=4 --reuse-session --headless -v --dashboard --html=report.html
247+
```
248+
249+
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.
250+
249251
--------
250252

251253
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>

0 commit comments

Comments
 (0)