SeleniumBase/examples
Michael Mintz 3f236d7461 Update the rate_limited decorator test 2017-04-22 23:26:50 -04:00
..
example_logs Move example log files to the example_logs folder 2016-06-18 18:57:27 -04:00
ReadMe.md Update the image link in the examples ReadMe 2017-03-13 22:30:31 -04:00
__init__.py Fresh Copy 2015-12-04 16:11:53 -05:00
basic_masterqa_test.py Update an example test 2017-03-13 19:57:47 -04:00
example_config.cfg Fresh Copy 2015-12-04 16:11:53 -05:00
gui_test_runner.py Flake8 spacing 2017-03-09 23:55:40 -05:00
masterqa_test.py Add an example test that utilizes MasterQA 2016-07-14 23:34:31 -04:00
my_first_test.py Update example comments 2017-04-14 15:57:00 -04:00
my_test_suite.py Getting ready for Python 3 compatibility (update print statements) 2016-06-25 14:30:31 -04:00
non_terminating_checks_test.py Add example test for non-terminating checks 2016-06-07 18:28:44 -04:00
rate_limiting_test.py Update the rate_limited decorator test 2017-04-22 23:26:50 -04:00
run_my_first_test_in_chrome.sh Fresh Copy 2015-12-04 16:11:53 -05:00
run_my_first_test_in_firefox.sh Fresh Copy 2015-12-04 16:11:53 -05:00
run_rate_limiting_test.sh Update the rate-limiting example test 2016-01-11 20:15:38 -05:00
run_test_fail_with_logging.sh Simplify example run commands with the ReadMe 2016-02-03 03:29:11 -05:00
setup.cfg Fresh Copy 2015-12-04 16:11:53 -05:00
test_fail.py Using the new syntax update (find_* can also be assert_*) 2016-05-30 17:08:32 -04:00

ReadMe.md

Running SeleniumBase Scripts

(NOTE: If you didn't install SeleniumBase properly, these scripts won't work. Installation steps include "pip install seleniumbase" and/or "python setup.py install" from the top-level directory.)

To makes things easier, here's a simple GUI program that allows you to kick off a few example scripts by pressing a button:

python gui_test_runner.py

(NOTE: With the exception of my_first_test.py, which should pass, many other tests in this folder fail on purpose to demonstrate features such as screenshots on failure, exception logging, and test reports.)

If you run scripts with logging enabled, (using --with-testing_base), youll see two folders appear: “latest_logs” and “archived_logs”. The “latest_logs” folder will contain log files from the most recent test run, but logs will only be created if the test run is failing. Afterwards, logs from the “latest_logs” folder will get pushed to the “archived_logs” folder if you have have the ARCHIVE_EXISTING_LOGS feature enabled in settings.py. Make sure to run python setup.py install for your changes to take effect if you make any changes to that file.

For running scripts the usual way, here are some of the example run commands: (Note: You can replace nosetests with py.test for most of these.)

Run the example test in Chrome:

nosetests my_first_test.py --with-selenium --browser=chrome

Run the example test in Firefox:

nosetests my_first_test.py --with-selenium --browser=firefox

Run the example test in PhantomJS:

nosetests my_first_test.py --with-selenium --browser=phantomjs

Run the example test in Demo Mode (runs slower and adds highlights):

nosetests my_first_test.py --browser=chrome --with-selenium --demo_mode

Run the example test suite in Chrome and generate an html report: (nosetests-only)

nosetests my_test_suite.py --with-selenium --browser=chrome --with-testing_base --report

Run the example test suite in Firefox and generate an html report: (nosetests-only)

nosetests my_test_suite.py --with-selenium --browser=firefox --with-testing_base --report

Run the example test suite in PhantomJS and generate an html report: (nosetests-only)

nosetests my_test_suite.py --with-selenium --browser=phantomjs --with-testing_base --report

Run a test with configuration specifed by a config file:

nosetests my_first_test.py --config=example_config.cfg

Run a test demonstrating the use of Python decorators available:

nosetests rate_limiting_test.py

Run a failing test with pdb mode enabled: (If a test failure occurs, test enters pdb mode)

nosetests test_fail.py --browser=chrome --with-selenium --pdb --pdb-failures

Run a failing test with logging:

nosetests test_fail.py --browser=chrome --with-selenium --with-testing_base --with-basic_test_info --with-page_source --with-screen_shots

(NOTE: If you see any *.pyc files appear as you run tests, that's perfectly normal. Compiled bytecode is a natural result of running Python code.)