Skip to content

Alexandersfg4/python_API_testing_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Building an API test automation framework with Python

The test API: https://m3o.com/user test

Purpose

To build own framework based on the knowledge: Test automation university

Setup

# Activate venv
souce env/bin/activate
# Install all dependencies in your virtualenv
pip install -r requirements.txt 

Paste your API Key inside .env

API_KEY = "dasfsd3223sdfsdf23ds"

How to run

# Run all test cases
pytest -v
# Run smoke check only
pytest -m smoke_check -v

Implemented test cases

I have named test files based on functionality
create_test.py contains the next test cases:

1. test_new_user_can_be_added
Steps:

  • Create new user account
    Excepted result: status code = 200
  • Read that the user exists
    Excepted result: status code = 200, Json response = data sent on step 1


2. test_add_user_invalid_data
Steps:

  • Create new user account
    Excepted result: status code = 500
  • Read that the user doesn't exis
    Excepted result: status code = 500


delete_test.py contains the next test cases:

1. test_new_user_can_be_deleted
Steps:

  • Create new user account
    Excepted result: status code = 200
  • Delete the user
    Excepted result: status code = 200
  • Read that the user doesn't exis
    Excepted result: status code = 200, response end with None


2. test_not_existed_user_can_not_be_deleted
Steps:

  • Delete not existed user
    Excepted result: status code = 400


update_test.py contains the next test cases:

1. test_user_can_be_updated
Steps:

  • Update existed user
    Excepted result: status code = 200
  • Read the user by id/username
    Excepted result: status code = 200, updated data is correct
  • Update existed user to initial state
    Excepted result: status code = 200
  • Read the user by id/email
    Excepted result: status code = 200, updated data is correct


2. test_user_can_not_be_updated
Steps:

  • Update not existed user
    Excepted result: status code = 500

About

Repository for educational purposes only

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published