293bf8879c | ||
---|---|---|
.. | ||
boilerplates | ||
capabilities | ||
chart_maker | ||
example_logs | ||
master_qa | ||
offline_examples | ||
presenter | ||
tour_examples | ||
translations | ||
visual_testing | ||
ReadMe.md | ||
__init__.py | ||
basic_test.py | ||
custom_settings.py | ||
decryption_test.py | ||
edge_test.py | ||
example_config.cfg | ||
github_test.py | ||
gui_test_runner.py | ||
handle_alert_test.py | ||
image_test.py | ||
ip_cow_test.py | ||
locale_code_test.py | ||
my_first_test.py | ||
nth_child_test.py | ||
parameterized_test.py | ||
proxy_test.py | ||
rate_limiting_test.py | ||
raw_parameter_script.py | ||
setup.cfg | ||
swag_labs_suite.py | ||
test_agent.py | ||
test_apple_site.py | ||
test_checkboxes.py | ||
test_chinese_pdf.py | ||
test_chromedriver.py | ||
test_deferred_asserts.py | ||
test_demo_site.py | ||
test_double_click.py | ||
test_download_files.py | ||
test_drag_and_drop.py | ||
test_error_page.py | ||
test_event_firing.py | ||
test_fail.py | ||
test_get_locale_code.py | ||
test_get_pdf_text.py | ||
test_get_user_agent.py | ||
test_hack_search.py | ||
test_inspect_html.py | ||
test_login.py | ||
test_markers.py | ||
test_null.py | ||
test_pdf_asserts.py | ||
test_pytest_parametrize.py | ||
test_request_sb_fixture.py | ||
test_sb_fixture.py | ||
test_skype_site.py | ||
test_suite.py | ||
test_swag_labs.py | ||
test_tinymce.py | ||
test_usefixtures.py | ||
test_xfail.py | ||
timeout_test.py | ||
upload_file_test.py | ||
user_agent_test.py | ||
xpath_test.py |
ReadMe.md
Running Example Tests:
- SeleniumBase tests are run with pytest.
- Chrome is the default browser if not specifed.
- During test failures, logs and screenshots from the latest test run are saved to the
latest_logs/
folder. - Example tests are located in SeleniumBase/examples/.
(NOTE: Some example tests fail on purpose to demonstrate logging features.)
Example run commands to help you get started:
Run an example test in Chrome: (Default: --browser=chrome
)
pytest my_first_test.py
Run an example test in Firefox:
pytest my_first_test.py --browser=firefox
Run an example test in Demo Mode: (highlight assertions)
pytest my_first_test.py --demo
Run a different example in Demo Mode:
pytest test_swag_labs.py --demo
Run an example test in Headless Mode: (invisible browser)
pytest my_first_test.py --headless
Run an example test using Chrome's mobile device emulator: (default settings)
pytest test_swag_labs.py --mobile
Run tests with verbose output: (includes more details)
pytest test_suite.py -v
Run a test on the Demo Site to try many SeleniumBase methods:
pytest test_demo_site.py
Run tests multi-threaded using [n] threads:
pytest test_suite.py -v -n=4
Run a parameterized test: (Generates multiple tests from one)
pytest parameterized_test.py -v
Run a test suite and generate a pytest report: (pytest-only)
pytest test_suite.py -v --html=report.html
Run a failing test: (See the latest_logs/
folder for logs and screenshots)
pytest test_fail.py
Run a failing test with Debug-mode enabled: (pdb
activates on failures)
pytest test_fail.py --pdb -s
Run an example test suite that demonstrates the use of pytest markers:
pytest -m marker_test_suite -v
Run an example test suite that reuses the browser session between tests:
pytest test_suite.py --reuse-session -v
Run an example test demonstrating the rate_limited
Python decorator:
pytest rate_limiting_test.py
Run an example test that demonstrates how to upload a file to a website:
pytest upload_file_test.py
SeleniumBase tests can also be run with nosetests
:
Run an example test with nosetests:
nosetests my_first_test.py
Run an example test suite and generate a nosetest report: (nosetests-only)
nosetests test_suite.py --report --show-report
Run an example test using a nosetest configuration file: (nosetests-only)
nosetests my_first_test.py --config=example_config.cfg
For more advanced run commands, such as using a proxy server, see ../help_docs/customizing_test_runs.md
To make things easier, here's a simple GUI program that allows you to run a few example tests by pressing a button:
python gui_test_runner.py