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
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:
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
-
193
174
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="28" /> Example tests using Logging:</h3>
194
175
176
+
To see logging abilities, you can run a test suite that includes tests that fail on purpose:
177
+
195
178
```bash
196
-
pytest test_suite.py --browser=chrome
179
+
pytest test_suite.py
197
180
```
198
181
199
182
🔵 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
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.
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
248
231
232
+
<h3><imgsrc="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:
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
+
249
251
--------
250
252
251
253
<h3><imgsrc="https://seleniumbase.io/img/logo6.png"title="SeleniumBase"width="32" /> The SeleniumBase Dashboard:</h3>
0 commit comments