Skip to main content

Framework for rapid development of API tests and report generation

Project description

image

Framework for rapid development of API tests and report generation

Supported Versions

Authors

Features

  • Rapid and straightforward development of tests using high-level methods
  • Generating a report with test results in Allure
  • The report will be useful for stakeholder

Installation

Install my-project with pip:

  pip install anna-api-test-framework

Usage/Examples

from anna import Action, Report, Assert

@Report.epic('Simple tests')
@Report.story('Tests google')
@Report.testcase('https://www.google.com', 'Google')
@Report.link('https://www.google.com', 'Jast another link')
class TestExample:

    @Report.title('Simple test google')
    @Report.severity('CRITICAL')
    def test_simple_request(self):
        url = 'https://google.com'
        method = 'GET'
        want = 200 
        # insert discription of the test
        Report.description(url=url, method=method, other='other information')
        # doing request and geting response
        action = Action(url=url)
        response = action.request(method=method)
        got = response.status_code
        # checking response
        with Report.step('Checking response'):
            Assert.compare(
                variable_first=want,
                comparison_sign='==',
                variable_second=got,
                text_error='Response status code is not equal to expected'
            )

For run test and generat a report use following commands:

  pytest alluredir="./results"

For generat and open a report you need to install Allure and use the following commands:

  allure generate "./results" -c -o "./report"
  allure open "./report"

After that, the generated report will automatically open in your browser

image

The report contains all the information you need

image

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

anna-api-test-framework-0.0.4.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file anna-api-test-framework-0.0.4.tar.gz.

File metadata

File hashes

Hashes for anna-api-test-framework-0.0.4.tar.gz
Algorithm Hash digest
SHA256 5d23b52ee848c1dfd3fe213e1ce26b2538a2d07b1d6eef2fc6712953c191d726
MD5 cde23056753135b1119d981cdd12cacc
BLAKE2b-256 69a5b85d04ab161572a50e2594c5c13056e2fbb072875cfbe788a0a3e8301c3f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page