VERY EARLY DRAFT
Automated tests for Commotion Router
Originally designed to minimize manual input testing on router UI. Many tests, particularly tests of unprivileged functions, use Selenium where it is very inefficient to do so, but are included as simple examples of test structure.
Usage
py.test
to run all available tests, or
py.test tests/<test_file.py>
to run a specific set of tests
Pytest will automatically discover any tests using its defined naming conventions.
Pytest command line defaults are set in the file pytest.ini. Pytest behavior can be configured using the file tests/conftest.py.
See the Pytest documentation for details.
Required Packages
- Python (v3)
- Python development libraries
- Bunch
- Pytest
- Netifaces
- Selenium
- Unittest
- Random
Basic Structure
- tests/ - Unit tests, separated by type or profile
- objects/ - All objects used in the tests
- browser.py - Objects representing the browser/user
- exceptions.py - Commotion-specific exceptions
- malicious_strings.py - Standard strings for use in input validation tests
- util.py - Utility functions
- router/ - Objects used in router-based tests
- router.py - router-specific node objects
- page/ - Objects found only in router-based UI pages
- page.py - Page definitions for router-based nodes
Resources
- http://pytest.org/latest/example/
- http://pytest.org/latest/contents.html
- http://engineeringquality.blogspot.com/2012/12/python-quick-and-dirty-pageobject.html
- http://pragprog.com/magazines/2010-08/page-objects-in-python
- http://computerrecipes.wordpress.com/2012/09/11/page-objects-design-pattern-for-selenium-webdriver/