Skip to main content

Data/Configuration Driven REST API Test Automation Library. Can be used as a Robot Framework Library or as standalone CLI tool.

Project description

QATLibrary

gh ci gh tests PyPI version Maintenance License: MIT

QAT (Quick API Tests) Library is a Data/Configuration Driven REST API Test Automation Library. Can be used as a Robot Framework Library or as standalone tool (CLI). This tool does not solve complex REST API automation scenarios, rather, provides a simple, lightweight and data-driven approach to create automated REST API tests quickly. For complex flows, it is recommended to use the library with Robot Framework.

Features

  • No coding required. Quick and easy implementation for REST API Tests.
  • Initialize sample config and Test Data with a single command.
  • Run from CLI (CI/CD friendly).
  • Store Test Data, Documentation and Assertions in CSV File.
  • Authorization: Basic, Digest, OAuth1
  • Run as a Robot Framework Library with Dynamic Test Generation Support.
  • Supports all HTTP Methods, SSL Certificates, Proxy Server, Stream, Redirection, Request Timeout etc.
  • Robot Framework based execution, reports and logs (CLI or Library).

Built-in Assertions

  • Status Code
  • JSON Schema
  • Response Body
  • Response Headers
  • Response Time/SLA
  • Server Certificate

Install QATLibrary

QATLibrary is available in PyPI. You can install using Pip:

pip install qatlibrary

Execution

Getting started from scratch is only a few commands away. Follow -

  1. Generate Sample Test Data CSV and Config YAML from CLI run (Skip this step if you already have Test Data and Config files):

    qat init
    
  2. Execute Tests Using CLI (standalone):

    qat run -c config.yaml -f TestCases.csv
    
  3. Delete report files (*.html and *.xml) in current directory:

    qat clean
    

    or to clean a specific report directory:

    qat clean -d path/to/dir
    
  4. For CLI Help (shows all required and optional args, usage etc):

    qat --help
    

Use as Robot Framework Library

Example:

*** Settings ***
Library          QATLibrary
Suite Setup      QAT Dynamic Tests Setup        csvFile=${csvData}
Variables        config.yaml        # Or can be a robot framework variable (Test/Suite/Variablefile etc.)

*** Variables ***
${host}          httpbin.org
${csvData}       Tests.csv

*** Test Cases ***
Place Holder Test
    [Documentation]  Placeholder Test Required by Robot Framework Suite Runner.  
    No Operaiton 

Configurations and Test Data

QATLibrary requires a CSV file with required data to drive the tests. Config yaml or .py files can inject your desired configurations during execution.

Generating Sample Test Data CSV and Config YAML is easy. Simply run:

qat init

This command should generate two sample files like below -

  1. Sample CSV Test Data: Test Cases or Data file. Test cases gets generated based on this file's content using Robot Framework.

  2. Sample Config YAML: This file contains various runtime configurations for tests. Can be utilize to accommodate various CI or Test environments. Please follow the inline comments for more details -

    host: httpbin.org           # Required
    
    #optional args
    timeout: 5                  # Default 5 seconds
    allow_redirects:            # Allow Redirects. Default True. 
    stream:                     # True/False. 
    http_proxy:                 # HTTP Proxy. Default None. 
    https_proxy:                # HTTPS Proxy. Default None.
    
    verify_server_cert: True    # True/False or path to CA Bundle. Default False. 
    certificate:                # .pem format certificate. Default None
    private_key:                # .pem format private key (unencrypted). Default None
    
    # Required if using Basic/Digest Auth (Default None)
    authUser:             
    authPass:
    
    # Required if using OAuth1 auth (Default None)
    oauth1_app_key:
    oauth1_app_secret:
    oauth1_user_token:
    oauth1_user_token_secret:
    

Once the files are generated, you can rename them according to your test suites or requirements.

Contributing

This is Sharif. I started this project basically to make my life a bit easier around simple REST API tests. This project is ideal for you if want to get some automated tests done quickly for your projects without coding and powerful assertion methods out of the box.

QATLibrary is on GitHub. Get in touch, via GitHub or otherwise, if you've got something to contribute, it'd be most welcome! Please follow the CONTRIBUTING.md for detailed guidelines.

License

QATLibrary is open source software provided under the MIT License. Please follow LICENSE.md for more details.

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

QATLibrary-21.2.12.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

QATLibrary-21.2.12-py2.py3-none-any.whl (13.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file QATLibrary-21.2.12.tar.gz.

File metadata

  • Download URL: QATLibrary-21.2.12.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for QATLibrary-21.2.12.tar.gz
Algorithm Hash digest
SHA256 a3475472ec488cfb5a917182da1a8482999c41b4cf43312c4292380771823e79
MD5 76bda9fd75706850be1c3d6a99263178
BLAKE2b-256 16769b0571125dbc66a17e9d526cfd1cc23af4d585229e7a58431c9418589d3c

See more details on using hashes here.

File details

Details for the file QATLibrary-21.2.12-py2.py3-none-any.whl.

File metadata

  • Download URL: QATLibrary-21.2.12-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for QATLibrary-21.2.12-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0f58ac3e3908206f25687a7276a65fc53d05909c75599bb0dadb72f7228ed010
MD5 4ac5df85e00d0947a8d6680ad2413230
BLAKE2b-256 ee1e7e42ff6d538b55aedfaddcf309c7af13b575ecccbf8b062ac4abd6b7e495

See more details on using hashes here.

Supported by

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