Skip to content

My final test project for the Test Automation Selenium and Python course

License

Notifications You must be signed in to change notification settings

Lexxx42/final_test_project

Repository files navigation

final_test_project

My final test project from course Test Automation Selenium and Python

Commands for test runner

  1. Use the following command to run all tests
pytest -v --tb=line --language=en .
  1. Check test_login_page.py, test_main_page.py, test_product_page.py for page specific test run commands.

Used tools

Link to the course

Автоматизация тестирования с помощью Selenium и Python

How to run the tests on your machine

  1. Create a local project using Virtualenv
  2. Clone this repository using following command
git clone https://github.com/Lexxx42/final_test_project.git
  1. Install Python 3.11 if you haven't already
  2. Install ChromeDriver
  • Work tested for Chrome Version 110.0.5481.178 (Official Build) (64-bit)
  1. Install GeckoDriver
  • Work tested for Firefox Version 110.0 (64-bit)
  1. Add drivers to the Environment Variables based on your OS settings
  1. Install requirements using the following command
pip install -r requirements.txt
  1. Run the following command to start the tests
pytest -v --tb=line --language=en .
  1. You can change webdriver to firefox
pytest -v --tb=line --language=en --browser_name=firefox .
  1. You can change language to
['ru', 'en', 'fr', 'es']

Example:

pytest -v --tb=line --language=fr .

Use this sequence of commands to run the container:

  1. To run the application in docker, you need to install docker-compose:
sudo apt install docker-compose 
  1. Clone the repository
git clone https://github.com/Lexxx42/final_test_project.git
  1. Change directory to project dir
cd final_test_project/
  1. Create folder logs in clonned repository
mkdir logs
  1. Start the build
docker-compose up --build
  1. You can set ENTRYPOIN in docker-compose.yaml to start tests right away. Or use the commands with your docker image.

With volume if you need logs in a file. (Directory logs must be created before use of the command)

docker run -v ~/logs:/autotests/test_project/logs autotest_pytest pytest -v -s -rx -m negative --browser_name=firefox

And without volume.

docker run autotest_pytest pytest -v -s -rx -m negative

You are free to use all the test markings and/or files in this repository in a docker container.

Added feature to create html test reports

All reports saved to /logs directory

  • To use the feature use pytest commands without -s argument to capture the logs
pytest -m negative --tb=line
pytest -m negative --tb=line --browser_name=firefox
  • You can use those commands with docker container
docker run autotest_pytest pytest -m negative --tb=line
docker run autotest_pytest pytest -m negative --tb=line --browser_name=firefox

Reports will be saved to /logs directory so mount a volume You will need to create a directory logs in your current user's home directory

mkdir logs
docker run -v ~/logs:/autotests/test_project/logs autotest_pytest pytest -m negative --tb=line --browser_name=firefox
docker run -v ~/logs:/autotests/test_project/logs autotest_pytest pytest -m negative --tb=line

About

My final test project for the Test Automation Selenium and Python course

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published