API tests for https://petstore.swagger.io/
Write a python class/module to:
1. Create and return a new Pet with:
a. Id
b. Category_name
c. Pet_name
d. Status
e. tagName
f. photoUrl
2. Verify The Pet was created with correct data.
3. Update this Pet_name, Verify update and return record.
4. Delete the Pet and demonstrate pet now deleted.
-
Clone/download project from GIT repository
-
Add demo_pet root directory to PYTHONPATH:
a. Windows:
PATH=%PATH%;C:\your\path\here\
b. Linux:
PATH=$PATH:~/ paste_your_path_here
orPATH=~/paste_your_path_here:$PATH
c. macOS:
PATH: export PATH=$PATH:/new/dir/location1
-
checking PATH:
echo "$PATH"`` **_or_** ``printf "%s\n" $PATH
-
Make sure that you have Python on your machine.
-
Check that you have valid pip version:
pip --version
-
pip upgrading:
python -m pip install --upgrade pip
-
pipenv installation process:
Linux :
sudo apt install pipenv
Mac OS :
brew install pipenv
-
Create independent environment:
pip install pipenv
-
Install all dependencies that is available in the Pipfile for current project
-
Check the list of all packages:
pip list
-
Create virtual environment:
pipenv install
. By default, after command execution you will have .virtual.env folder in the root or user folder. -
To activate the environment:
pipenv shell
- Activate environment for current project:
pipenv shell
- Go to the ‘feature’ folder (../features)
- Check that you have ‘behave’ module:
behave –version
- Check the list of available tests in the ‘feature’ folder. The have
.feature
extension.
EXAMPLE : behave -k --tags=@test
where @test
is a tag name for the executed test. Each feature file has different tests and
related tags.
Complete all steps from Base configuration section.
Be sure that you have related folder in .virtualenvs
-
In case if you are usgin PyCharm , add Run/Debug configuration. By default (This manual is for PyCharm IDE.)
-
Create/Update configuration according to available tags in the tests:
-
All commands related to the test execution should be run in the ‘feature’ folder.
-
Common command for executing test is
behave -k --tags=@test
Available tests:
@e2e
,@pet_app
-
When all tests will executed you can check ‘reports’ folder. It should contain ‘pet_logger.log’ with detailed information about each action.