Skip to main content

A generic library to compare two HTTP Requests using Robot Framework

Project description

Robot Framework - HTTPCompare

Introduction

This keyword lets you compare two HTTP Requests, given that both the requests are made using 'Make HTTP Request' keyword:

  • This enables comparison of JSON response bodies and status codes as of now.
  • It will log the difference between response bodies and status codes in robot report and pass/fail the testcase accordingly.
  • Difference between both the responses is termed as Divergence.
    • Actual Divergence (difference between the two responses)
    • Expected Divergence (difference which is acknowledgeably expected by user, should be supplied by the user while invoking this keyword)
  • This keyword will compare the actual divergence and expected divergence and will pass if they match, otherwise will highlight the differences and fail.

License

Prerequisites

HTTPCompare Library has following prerequisites:

robotframework>=3.1.2
jsonpath-ng>=1.4.3
setuptools>=39.1.0

you can install all the prerequisites either one by one or using the requirements.txt provided with source code:

pip install -r requirements.txt

Installation

HTTPCompare Library can be easily installed using pip with following command:

pip install robotframework-httpcompare

Alternatively it can also be installed from the sourcecode:

python setup.py install

Compare HTTP Requests

Compare HTTP Requests is the main keyword of RESTLibrary, it has all the possible parameters which are needed for making any HTTP/REST request along with other parameters needed for various facets of REST API Automation.

Parameters:

requestId_1 : request id of first request

requestId_2 : request id of second request

expectedDivergence : difference between the two responses, which is acknowledgeably expected by user, should be provided in the format of actual divergence which is logged in robot report. Only difference is that it has expected_ node rather than actual_ nodes.

ignoreNodes : a list of json-paths of the nodes which we want to be ignored while response body comparison

responseComparisonScheme : this parameter is useful to specify how we want our response bodies to get compared. In case of not sorted comparison, where we want to skip the sequence and verify the arrays with items in random order example : [{"path":"$.items","type":"NotSorted","key":"name"},{"path":"$.items[*].links","type":"NotSorted","key":"rel"}]

responseComparisonType : type of baseline verification required, default is FULL, other supported values are PARTIAL.

responseNames : using this parameter we can respectively attach nomenclature to the requests provided for comparison, ex responseNames=['elasticsearch response', 'lambda response']

Contributions:

Creator and maintainer : Deepak Chourasia

License

HTTPCompare Library is open source software provided under the Apache License 2.0

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-httpcompare-1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

robotframework_httpcompare-1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file robotframework-httpcompare-1.0.tar.gz.

File metadata

  • Download URL: robotframework-httpcompare-1.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.6

File hashes

Hashes for robotframework-httpcompare-1.0.tar.gz
Algorithm Hash digest
SHA256 dc4012131f064924e53fc7bf17bd9fb0f9e9ff21cf990c439239a097797c3c45
MD5 3eacadf2fd6f7b83e0edc9375d317e67
BLAKE2b-256 1533eea3fa977abf3a7637b6f632e0c8035a68ca9480f87b5c25a27c8cd69c82

See more details on using hashes here.

File details

Details for the file robotframework_httpcompare-1.0-py3-none-any.whl.

File metadata

  • Download URL: robotframework_httpcompare-1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.6

File hashes

Hashes for robotframework_httpcompare-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fba4be8c68ec094c55f205f88f23a14d0c49a0fd3f629b537a206023bccd21b2
MD5 72987590f1750c373dba08b554ab393b
BLAKE2b-256 d54100f89c212b305f4d223c3eb4d0e93bcb0d00fb6dce4ba5d5e9567eed6bff

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