api-automation-kit-package (beta version)
Project description
Introduction
api-automation-kit is a Python package that (TODO: need to complete)
Main Features
Here are just a few of the things that api-automation-kit including:
- Codeless Automation Framework For Performance and Rest API Tests - based on Streamlit and Locust python packages
- API capbabilities - based on Requests python package
- Upload Artifact to Pypi and Azure
- API Test Plan Capabilities For Azure TFS
- Interactive Test Report - based on Allure framework
Environment and Installations
The source code is currently hosted on GitHub at: https://github.com/api-automation-kit
Binary installers for the latest released version are available at the Python Package Index (PyPI)
# PyPI
pip install api-automation-kit
Scoop Installation (for windows)
See the full installation instructions for Scoop
Allure Installation
See the full installation instructions for allure
Code Examples:
ui_app.py
# the code for open the ui app
import os.path
import api
path = os.path.dirname(__file__)
api.ui_app.run_app(main_path=path)
# run from command line
$ streamlit run ui_app.py
After a few seconds, the app will start on the default browser.
Try to write your API test like the example below:
Click on Save Result Check-Box for saving the Python syntax result:
The Python script moved to project folder:
For run the test return to the web app and click on the Run Script.
After a few seconds, the test results will appear in a new tab:
rest_api.py
# the code for open the ui app
import allure
import api
@allure.feature("Set Feature For get_en_stable_")
@allure.description("Set Description For get_en_stable_")
def test_get_en_stable_():
component_get_en_stable_()
@allure.step("Set Step Description For get_en_stable_")
def component_get_en_stable_():
api_instance = api.rest_api.ApiCapabilities()
response = api_instance.get_request(url='http://docs.locust.io:80/en/stable/?', headers={"Content-Type":"application/json"})
analyze_response(response, 200)
@allure.step("Expected Status Code")
def analyze_response(res, expected_status_code):
if res.status_code != expected_status_code:
assert False
else:
print(f"status code is {res.status_code}")
# run the tests from command line
$ py.test rest_api.py --alluredir=tmp/allure_results
# generate report from command line
$ allure serve tmp\allure_results
upload_artifact.py
# upload python package to azure or pypi by developer selection
import os
from api import artifact
PYPI = True
pypi_user = '{user}'
pypi_password = '{password}'
AZURE = False
azure_feeds = ['{azure-feed-1}', '{azure-feed-2}']
dist_dir = os.path.dirname(__file__) + "/dist"
artifact.run_process(dist_dir=dist_dir, azure_feeds=azure_feeds, azure_artifact=False,
pypi_artifact=True, user=pypi_user, password=pypi_password)
azure_tp.py
# need to complete
Dependencies
- allure-pytest~=2.9.43
- allure-python-commons~=2.9.43
- setuptools~=57.4.0
- genson~=1.2.2
- artifacts-keyring~=0.3.1
- twine~=3.4.2
- wheel~=0.37.0
- pandas~=1.3.3
- streamlit~=1.0.0
- locust~=2.2.3
- requests~=2.26.0
- azure-devops==6.0.0b4
- xmltojson~=0.2.0
- msrest~=0.6.21
See the full installation instructions for minimum supported versions of required, recommended and optional dependencies.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for api_automation_kit-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b719af82cbce004907c5568d6227e118829a2c773f27a7ac72145d3fe6583c7f |
|
MD5 | cd15f99038eb50e9540b8fb18f616b94 |
|
BLAKE2b-256 | 9eb2a282331aab9a99cc809169cc98a0c7fdc35ed16d532d623c63eb4aff3e97 |