Task to demonstrate the automation testing of Udemy search functionality
This requires Python3 installed on your system. It also needs pipenv to manage package dependencies. Also, since they are UI Tests, having a Webdriver on the machine is recommended. This shall use Chromedriver. Follow the below steps to get it up and running on your local machine:
- Clone this Github repository
- Run
pipenv installwhich shall install all the dependencies specified in the Pipfile and generate Pipfile.lock.
[project working directory]
|‐‐ [Pipfile]
|-- [test directories]
| |-- features
| | `-- *.feature
| `-- step_defs
| |-- __init__.py
| |-- conftest.py
| `-- test_*.py
`-- [pytest.ini]
As per standard conventions, the entire code should reside inside a directory called tests which shall have features and step_defs as subfolders. step_defs can also contain conftest.py file which contains some fixture functions which are to be utilized by multiple tests. Lastly, pytest.ini file is used to register a custom marker to avoid warnings while test execution
The command used to run the tests is pipenv run python -m pytest. Also, there is a provision to run the tests by providing the tag names. It can be achieved by appending -k and the tag name. e.g. pipenv run python -m pytest -k automated
This framework uses pytest-html plugin to generate html reports for the test runs. To generate a report, run the command pipenv run python -m pytest -k automated --html=report.html