Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.



OpenApiDriver for Robot Framework®

OpenApiDriver is an extension of the Robot Framework® DataDriver library that allows for generation and execution of test cases based on the information in an OpenAPI document (also known as Swagger document). This document explains how to use the OpenApiDriver library.

For more information about Robot Framework®, see http://robotframework.org.

For more information about the DataDriver library, see https://github.com/Snooz82/robotframework-datadriver.


Note: OpenApiDriver is currently in early development so there are currently restrictions / limitations that you may encounter when using this library to run tests against an API. See Limitations for details.


Installation

If you already have Python >= 3.8 with pip installed, you can simply run:

pip install --upgrade robotframework-openapidriver


OpenAPI (aka Swagger)

The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs, see https://swagger.io/specification/

The OpenApiDriver module implements a reader class that generates a test case for each endpoint, method and response that is defined in an OpenAPI document, typically an openapi.json or openapi.yaml file.


How it works

If the source file has the .json or .yaml extension, it will be loaded by the library (using the prance library under the hood) and the test cases will be generated.

*** Settings ***
Library            OpenApiDriver
...                    source=openapi.json
Test Template      Do Nothing


*** Test Cases ***
Some OpenAPI test for ${method} on ${endpoint} where ${status_code} is expected

*** Keywords *** ***
Do Nothing
    [Arguments]    ${endpoint}    ${method}    ${status_code}
    No Operation

It is also possible to load the openapi.json / openapi.yaml directly from the server by using the url instead of a local file:

*** Settings ***
Library            OpenApiDriver
...                    source=http://127.0.0.1:8000/openapi.json

Since the OpenAPI document is essentially a contract that specifies what operations are supported and what data needs to be send and will be returned, it is possible to automatically validate the API against this contract. For this purpose, the openapi module also implements a number of keywords.

Details about the Keywords can be found here.


Limitations

There are currently a number of limitations to supported API structures, supported data types and properties. The following list details the most important ones:

  • Only JSON request and response bodies are currently supported.
  • The unique identifier for a resource as used in the paths section of the openapi document is expected to be the id property on a resource of that type.
  • The id is expected to be a UUID (v4).
  • No support for query strings at this time.
  • No support for headers.
  • Limited support for authentication
    • username and password can be passed as parameters to use Basic Authentication
    • A requests AuthBase instance can be passed and it will be used as provided.
    • No support for per-endpoint authorization levels (just simple 401 validation).
  • exclusiveMinimum and exclusiveMaximum not supported yet.
  • byte, binary, date, date-time string formats not supported yet.

Release files for robotframework-openapidriver 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-openapidriver 2.0.0
File Size Uploaded
robotframework-openapidriver-2.0.0.tar.gz 24.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-openapidriver 2.0.0
File Interpreter ABI Platform
robotframework_openapidriver-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.6 kB

Release files / robotframework-openapidriver-2.0.0.tar.gz

Download URL robotframework-openapidriver-2.0.0.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
644354ed9b07547bbba45da1b11400ce54258b420e310f4f30870b0b92421a3d
BLAKE2b-256 checksum
How to use checksums
b98348374dda9a11565a723213bc7d685900566772881d37c67bf0f14df6f4f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.5 Windows/10

Release files / robotframework_openapidriver-2.0.0-py3-none-any.whl

Download URL robotframework_openapidriver-2.0.0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e62e758d7afb3532d93b808667043329a85cd6bd1d66452b4223e0ccff5e1e12
BLAKE2b-256 checksum
How to use checksums
2fb0cba6b9f2ad52ffd63fe23510ee612e2a14e5a03b9ec2fa543aa07ee33048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.5 Windows/10

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page