This repository contains automated test scripts for the demo site Demoblaze written in Python using Selenium and pytest.
- The required Python libraries are already listed in the
requirements.txtfile. - Run the following command to install them:
pip install -r requirements.txt
Open the config.ini file and update the settings if needed.
- To run all test scripts without reporting:
pytest tests
- To run tests and generate Allure reports and view it:
pytest tests --alluredir=./allure_reports_json allure generate allure_reports_json -o allure_report --clean allure open allure_report
- Log files are generated automatically as per settings in conftest.py.
- tests/: Contains all the test scripts.
- page_objects/: Contains the page object model structure for the project.
- configurations/: Contains configuration files, including the
config.iniused to manage settings. - logs/: Stores log files generated during test execution.
- allure_report/: Generated Allure reports can be viewed by running the
allure opencommand as described above.
- Python: The primary programming language for scripting the tests.
- Selenium: For web automation and interaction with the browser.
- pytest: For test execution.
- Allure: For generating beautiful HTML reports.
- pytest-order: For ordering the execution of test cases and test classes.
- openpyxl: For data-driven testing using Excel.
The sample output can be viewed by running the following command which will open the generated Allure report in your default browser.:
allure open allure_reportFollow these steps to set up and run the test automation framework on your local machine:
To get a copy of the repository to your local system, run the following command in your terminal:
git clone https://github.com/rainman-77/Touchblack_qa_assessment.gitAlternatively, you can download the repository as a ZIP file directly from GitHub and extract it to your desired location.
Once you have the repository, navigate into the project folder:
cd Touchblack_qa_assessmentIt's recommended to use a virtual environment to manage project dependencies. To create a virtual environment, run:
For macOS/Linux:
python3 -m venv venvFor Windows:
python -m venv venvActivate the virtual environment:
For macOS/Linux:
source venv/bin/activateFor Windows:
venv\Scripts\activateInstall the required libraries listed in the requirements.txt file:
pip install -r requirements.txtOpen the config.ini file located in the configurations/ folder and modify the settings as per your requirements. For example, you may need to set your preferred browser, browser mode etc
After setting up the environment, you can run the tests. Use the above command shown in section Commands to Run Tests in Terminal
Log files are generated automatically based on the settings in conftest.py. You can find these log files in the logs/ folder.