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
You can interchange **pytest** with **nosetests** for most things, but using pytest is strongly recommended because developers stopped supporting nosetests. Chrome is the default browser if not specified.
74
+
You can interchange ``pytest`` with ``nosetests`` for most tests, but using ``pytest`` is recommended. (``chrome`` is the default browser if not specified.)
72
75
73
-
(NOTE: If you're using **pytest** for running tests outside of the SeleniumBase repo, **you'll want a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure**. If using **nosetests**, the same applies for [setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg).)
76
+
If you're using ``pytest`` for running tests outside of the SeleniumBase repo, you'll want a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure. If using ``nosetests``, the same applies for [setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg).
77
+
78
+
Here are some useful command-line options that come with ``pytest``:
74
79
75
-
Here are some useful command-line options that come with Pytest:
76
80
```bash
77
-
-v #Prints the full test name for each test.
78
-
-q #Prints fewer details in the console output when running tests.
81
+
-v #Verbose mode. Print the full name of each test run.
82
+
-q #Quiet mode. Print fewer details in the console output when running tests.
79
83
-x # Stop running the tests after the first failure is reached.
80
84
--html=report.html # Creates a detailed pytest-html report after tests finish.
81
85
--collect-only # Show what tests would get run without actually running them.
@@ -86,56 +90,70 @@ Here are some useful command-line options that come with Pytest:
86
90
-m=MARKER # Only run tests that are marked with the specified pytest marker.
87
91
```
88
92
89
-
SeleniumBase provides additional Pytest command-line options for tests:
93
+
SeleniumBase provides additional ``pytest`` command-line options for tests:
94
+
90
95
```bash
91
-
--browser=BROWSER # (The web browser to use.)
96
+
--browser=BROWSER # (The web browser to use. Default: "chrome")
92
97
--cap-file=FILE # (The web browser's desired capabilities to use.)
93
98
--cap-string=STRING # (The web browser's desired capabilities to use.)
--devtools # (Open Chrome's DevTools when the browser opens.)
135
+
--reuse-session # (Reuse the browser session between tests.)
136
+
--crumbs # (Delete all cookies between tests reusing a session.)
137
+
--maximize-window # (Start tests with the web browser window maximized.)
138
+
--save-screenshot # (Save a screenshot at the end of each test.)
134
139
--visual-baseline # (Set the visual baseline for Visual/Layout tests.)
135
140
--timeout-multiplier=MULTIPLIER # (Multiplies the default timeout values.)
136
141
```
142
+
137
143
(For more details, see the full list of command-line options **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py)**.)
138
144
145
+
You can also view a list of popular ``pytest`` options for SeleniumBase by typing:
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.
@@ -181,6 +199,7 @@ Or you can create your own Selenium Grid for test distribution. ([See this ReadM
181
199
```bash
182
200
pytest test_suite.py --browser=chrome
183
201
```
202
+
184
203
(During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. Those logs will get moved to ``archived_logs/`` if you have ARCHIVE_EXISTING_LOGS set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py), otherwise log files with be cleaned up at the start of the next test run.)
0 commit comments