Assignment 3 of Software Testing (Sem 221)
- Setting up Moodle build using Docker: https://github.com/catp3rson/Software_Testing_asm3/tree/main/moodle_build
- Install browsers:
- Chrome:
sudo apt-get install google-chrome
- Firefox:
sudo apt-get install firefox
- Edge: Download .deb file here and run
sudo dpkg -i microsoft-edge-beta_*.deb
- Chrome:
- Install dependencies:
pip install -r requirements.txt
- Config webdriver manager based on this guide. Configurations for webdriver manager should be written in
.webdriver_manager.env
(see.webdriver_manager_example.env
for the template) - Provide credentials for authentication (used to log in to BKeL) in
features/utils/config.py
: seeconfig_example.py
for the template
- Based on the workflow of Cucumber
- The steps are defined in Python files inside the
features/steps
folder. The filecommon.py
contains definitions of steps that are used in many scenarios. The step description and associated function name should NOT be duplicated. - The scenarios are defined in
.feature
file inside thefeatures
folder - The
utils
folder contains reusable code that is too lengthy to be put inside step definitions - Environmental controls are defined in
features/environment.py
. Read more about it here
- Go to the top-level folder
Software_Testing_asm3
- Run tests for specific functional requirements:
./run_tests.sh func_req_1.feature func_req_2.feature ...
- Example:
./run_tests.sh private_file_upload.feature
- Example:
- Run all tests:
./run_tests.sh
- In order to run a scenario/feature in multiple browsers, use the
@multibrowser
tag (seefeatures/private_file_upload.feature
file for example). - You can change the list of browsers to run tests in by modifying
CONFIG["DRIVERS"]["BROWSERS"]
infeatures/utils/config.py
. The fieldCONFIG["DRIVERS"]["DEFAULT_BROWSER"]
specifies which browser to use by default when a scenario/feature is not run in multiple browsers.
- It's best to install pre-commit hooks to re-format the files before pushing your work to origin. Commands:
pip install pre-commit
pre-commit install