Skip to content

mahmutovAR/API_testing

Repository files navigation

SDET2024 API task

Application for testing the API Service

Testcases

  • Create a new entity POST /api/create
  • Delete entity DELETE /api/delete/{id}
  • Get a single entity GET /api/get/{id}
  • Get a list of entities GET /api/getAll
  • Patch an entity PATCH /api/patch/{id}

Requirements

The Python packages can be installed by running

python3 -m pip install -r requirements.txt

Run run_test_service.py to build the API Service

docker compose up --build -d

running in test-service/


Run run_task_api.py to test the API Service

The allure-pytest is used for visualizing the results of a test run.

First pytest runs test cases

pytest --alluredir=allure-results --clean-alluredir

Then a file is created with information about the environment (for example)

os_platform = Linux
os_release = 6.8.0-40-generic
python_version = Python 3.10.15

Finally, allure converts the test results into an HTML report

allure generate allure-report --clean --single-file allure-results

And opens it in default browser

import webbrowser
webbrowser.open('index.html')

Files and directories:

  • allure-report/index.html allure report
  • allure-results/ test results directory
    Note: These directories will be created after running run_task_api.py
  • service_api/ API settings
  • test-service/ API Service
  • tests/ test modules
  • requirements.txt required packages
  • run_task_api.py API testing script
  • run_test_service.py API Service running script

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages