1) Download and Install python. (Don't forget to check the box next to "Add Python to PATH). Then click on "Install Now". After installation click on "Disable path length limit". Then click "close".
2) Install pip
Open command prompt and enter the following command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Press Enter.
If you are in C:\Users\vipin> location in command prompt, then this file will be downloaded to that place.
Cut and paste the get-pip.py file to the python directory(C:\Users\vipin\AppData\Local\Programs\Python\Python310\).
Change the current path of the directory in the command line, to the path of the directory where the above file exists. This is done by executing the following command in the command prompt :
cd /users/vipin/appdata/local/programs/python/python310
Press Enter.
Run the command given below:
python get-pip.py
Press Enter.
and wait through the installation process.
3) Install pytest
pip install -U pytest
Press Enter.
4) Install selenium
pip install -U selenium
Press Enter.
(Don't close the command prompt window)
5) View the version of your chrome browser and download chromedriver.exe for that chrome version from (https://chromedriver.chromium.org/downloads) (choose this file for windows: chromedriver_win32.zip) and extract the file and put chromedriver.exe in python's folder(C:\Users\vipin\AppData\Local\Programs\Python\Python310\).
6) Install pytest-html
In command prompt, type:
pip install -U pytest-html
Press Enter.
7) Install undetected-chromedriver
In command prompt, type:
pip install undetected-chromedriver
Press Enter.
8) Change the current path of the directory in the command line to the path of the project folder. This is done by executing the following command in the command prompt :
cd <drag the "test_cases" folder to the command line window>
Press Enter.
9) Command for running the test cases:
pytest -v --html=report.html --self-contained-html <the python file name to be tested>
Press Enter.
We will get the result of the test cases in the report.html in the current directory.
or
pytest -v --html=.\Reports\report.html --self-contained-html <the python file name to be tested>
Press Enter.
then we will get the ouput in a automatically created Reports directory.
Note: If you want to test individual test_case, then use this command: (for example to test the test_case "test_TS_1_1_1")
pytest -v --html=.\Reports\report.html --self-contained-html <the python file name to be tested>::test_TS_1_1_1
Comments
Post a Comment