For some time I’ve wanted to share an idiom I personally use and recommend when building Selenium Tests. This idiom allows to control which browsers are used to run the tests without needing to update test sources or configuration.
The simple ideas behind this idiom are:
- Test code and configuration should not depend on the test environment.
- Tests can be executed in any given browser, independently from others.
- To change the browsers used for test execution, it is not needed to update test sources or configuration.
- Selenium Grid URL and application URL are also configurable.
- Both environment variables and Java system variables can be used.
- All settings have sensible defaults.
I call this idiom ‘Browser-Selectable Tests’. I promise I keep thinking on a better name 🙂