This project is an automation test framework designed to test Hudl's front end web application using Selenium, Pytest and Pytest-BDD. The tests are written using the Behavioural Driven Development (BDD) framework.
They follow the Page Object Model design pattern to enable resuabililty and improve test maintenance.
The DriverFactory class uses the Factory design pattern to improve decoupling.
- Python 3.x.x
- Chrome or Firefox browser
- Valid Hudl accounts setup
- Open terminal and go to the folder you want to install this project.
cd /<MY_PATH>/
-
Clone the repository: You can this through GitHub -> Click Code or on the terminal below.
git clone https://github.com/AO-15/hudl-project.git
-
Install the required packages:
pip install -r requirements.txt
Folders:
- features: Gherkin feature files that define test case scenarios
- locators: Files that identify web elements locators.
- pages: Each file is a representation of the UI interactions of the page. Follows the Page Object Model design pattern.
- reports: Any reports or screenshots generated from the execution of test.
- utils: Helper methods and files like credentials (Temporarily) and selelenium_base.py
- tests: Pytest test scripts.
Files:
- conftest.py: Contains pytest fixtures and hooks.
- pytest.ini: Pytest configuration file, for example pytest marker definitions.
- settings.py: Global config settings like environment urls and browser.
- requirements.txt: Required project dependencies.
-
Go to the project directory.
-
To run the tests in Chrome:
pytest
- To run the tests in Firefox:
pytest --browser=firefox
- Recommended: To run tests and generate test reports :
pytest --html=reports/report.html --self-contained-html
OR
pytest --browser=chrome --html=reports/report.html --self-contained-html
- The test results will be displayed in the terminal.
- If you generated the test report, the HTML report will be inside the "reports" folder.
The tests are written using Pytest and are located in the tests directory. The conftest.py file contains the fixtures used throughout the tests.
- The tests are written in the Gherkin Language using BDD inside the
features
folder.- They files end with the *.feature file extension.
features/login_page.feature
- Next the step definitions live inside the
tests
folder.
- They are marked with fixture for example:
- In Gherkin:
Given I am on the Login Page
- In test_login.py, the method is given a function decoration like:
@given("I am on the Login Page")
- Firstly, create the test inside the feature folder using the Gherkin Language.
- Inside locators.py, create the class for the page and add the locators
- Create the page file for it inside the pages folder and add the functionality.
- Add a news test case inside the tests folder - ensure the file names start with like
test_*.py
- Use the login_page fixture to interact with the UI.
- Ensure the text inside the function decorators match the text inside the
.features
class
This project is licensed under the MIT License.