This is a small API test automation solution which caters to the following set of tests:
- Smoke tests
- Regression
QuotableAPI-automation
| README.md
| .gitignore
| requirements.txt
|_____ allure-report/
|_____ AllureReports/
|_____ features/
| |___steps
| |_____stepImpl.java
| |___environment.py
| |___ ... (tests/feature files)
|_____ jenkins-screenshots/
| |___ ... (screenshots in jpg/png format)
|_____ utils/
|___ configurations.py
|___ headers.py
|___ params.py
|___ payload.py
|___ properties.ini
- Please make sure you clone the repository in your local machine through correct git repo URL.
- The URL for this git repo can be found here.
- Please copy the
https/ssh
type, whatever suits you the best.
- Once the repo URL copied and the repo is cloned, please open you terminal. (in the current directory)
- Once the terminal is opened, run the following command :
pip install -r requirements.txt
- The
requirements.txt
is a file which tells python to install all the dependancies which are listed in that file.- NOTE : The versions are frozen. If you want to bump any dependancy to later version or change it for whatsoever reason, please raise a pull request and upon review, I will merge it.
- One the above command runs successfully without any error, run the following command to run all the tests/feature files :
behave -f allure_behave.formatter:AllureFormatter -o AllureReports
- This will generate json files based on the number of scenarios you run. So for example - in the above command, we haven't specified the file name to run, hence all the scenarios/files will be executed.
- If in case you want to run a particular file :
behave features/<filename>.feature -f allure_behave.formatter:AllureFormatter -o AllureReports
- After above command, run the following command to generate the report :
allure generate ./AllureReports --clean
- There may be instances where the tester may want to run specific suites, i.e., regression or smoke.
- In such cases, the
behave
utility provides us with a tagging mechanism to categorise any feature file with some tags like @regression or @smoke. - If we want to run only regression related cases, then please run the following command :
behave -f allure_behave.formatter:AllureFormatter -o AllureReports --tags=regression
- In such cases, the
- There may also be instances where the tester may want to see the logs/console prints for debugging at times.
- In such cases, the
behave
utility provides us with an extra attribute in the command to do just this. - Please run the following command :
behave --no capture -f allure_behave.formatter:AllureFormatter -o AllureReports --tags=regression
- In such cases, the
- Please open
allure-report
folder and look forindex.html
file. - Open that file in your desired web browser. That file is the allure report of our execution.