Update help docs

This commit is contained in:
Michael Mintz 2018-02-15 18:21:04 -05:00
parent 9ab39fa680
commit fa9f78a258
1 changed files with 8 additions and 29 deletions

View File

@ -16,39 +16,18 @@ In addition to [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/m
**Examples:** (These are run from the **[examples](https://github.com/seleniumbase/SeleniumBase/tree/master/examples)** folder.):
```bash
pytest my_first_test.py --browser=chrome
pytest my_first_test.py
nosetests my_first_test.py --with-selenium --demo_mode --browser=firefox
nosetests my_first_test.py --browser=firefox
pytest my_first_test.py --demo_mode --browser=chrome
nosetests my_test_suite.py --with-testing_base -s
```
(<i>The Selenium plugin, ``--with-selenium``, is enabled by default when using pytest to run test classes that inherit the [BaseCase](#seleniumbase_basic_usage) class, thanks to [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini). You can do the same for nosetests by adding ``with-selenium=1`` under ``[nosetests]`` in a [setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/setup.cfg) file located in the folder where you call nosetests.</i>)
**Here's how to run the example script on various web browsers by using nosetests:**
You can interchange **nosetests** with **pytest**. Chrome is the default browser if not specified. The ``-s`` option may produce additional output to make debugging easier.
(NOTE: You can interchange **nosetests** with **pytest**.)
```bash
cd examples/
nosetests my_first_test.py --with-selenium --browser=chrome
nosetests my_first_test.py --with-selenium --browser=firefox
nosetests my_first_test.py --with-selenium --browser=phantomjs
```
After the test completes, in the console output you'll see a dot (``.``) on a new line, representing a passing test. (On test failures you'll see an ``F`` instead, and on test errors you'll see an ``E``). It looks more like a moving progress bar when you're running a ton of unit tests side by side. This is part of nosetests. After all tests complete (in this case there is only one), you'll see the "``Ran 1 test in ...``" line, followed by an "``OK``" if all nosetests passed. The ``--with-selenium`` option is required for running GUI tests with nosetests (not needed when using pytest). If no browser is specified, Chrome will become the default. The ``-s`` option is optional, and that makes sure that any standard output is printed immediately on the command line when tests have print statements in them, which makes debugging much easier.
**Here's how to run the example script using pytest**:
```bash
cd examples/
pytest my_first_test.py --browser=firefox
pytest my_first_test.py --browser=chrome
pytest my_first_test.py --browser=phantomjs
```
(NOTE: If you're using **pytest** instead of nosetests for running tests outside of the SeleniumBase repo, **you'll need a copy of [pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini) at the base of the new folder structure**, already provided here.
(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).)
**Example tests using Logging**:
```bash