Provides steps for a Gauge project, that runs tests against APIs
Project description
Gauge API Steps
A Python module, that provides re-usable steps for testing APIs with the Gauge framework.
Description
This is an extensible and flexible test-automation library for Gauge. It enables users with and without programming knowledge to create end-to-end test scenarios in Markdown syntax. Developers can still easily extend their test scenarios with custom code. Python's urllib
is used to make requests against APIs. XML and JSON are supported and API responses can be validated with XPath and JSONPath.
Gauge Step Overview
Find the documentation on all Gauge steps of this project in the overview:
Quick Start
This is a library for the Gauge framework, so Gauge+Python must be installed first.
- Install Python >= 3.10 on your platform and make it available in the $PATH
- Install Gauge and create a test project with Python
It is useful to understand the basic workings of Gauge first. The documentation is excellent.
- Install this module
- Find out the path to this module after installation:
echo $( python -m site --user-site )/gauge_api_steps
- Add that path to the property
STEP_IMPL_DIR
inside the test project fileenv/default/python.properties
. Paths to multiple modules are comma separated.
Example on a Mac:STEP_IMPL_DIR = /Users/<user>/Library/Python/3.10/lib/python/site-packages/gauge_api_steps, step_impl
- Reload Visual Studio Code
- Write a new scenario in
specs/example.spec
. VSC offers auto-completion
Installation
This module can be installed from source:
cd path/to/gauge-api-steps
pip install --user .
Or the latest package can be downloaded and installed from PyPi:
pip install gauge-api-steps --user --upgrade
Development
When coding on this project, unit tests can be executed like this:
python -m unittest discover -v -s tests/ -p 'test_*.py'
Placeholders and Expressions
Step parameters allow the use of placeholders, that can be defined in the environment properties files. Some steps also allow to set a placeholder value manually. Property keys act as placeholders, they are defined like "${key}" and they will be replaced by its value if such a property key/value pair exists in any env/*/*.properties file or within the execution scope.
Some steps include parameters, that allow expressions, that will be evaluated.
Examples of allowed expressions include: =1
, >1
, <1
, >=1
, <=1
.
Internal Placeholders
Following placeholders are used internally to store data over multiple steps:
- _opener
- _response_csrf_header
- _request_csrf_header
- _csrf_value
- _body
- _response
- _headers
It is possible to access and manipulate them with certain steps.
Configuration
The Configuration follows the Gauge configuration approach. Some behaviour can be determined with properties.
Maintainers
Project details
Release history Release notifications | RSS feed
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
Hashes for gauge_api_steps-0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4988cefe16869d8d75f8c432c16e336f96ecc1737c67d36217263d50efceb069 |
|
MD5 | 48812bafa05cfbe623027f7f176a7ea2 |
|
BLAKE2b-256 | 85adc5476c9086be4230a9f7d53c267e40b98ab22fd3bc7114ebc3c470dc40af |