Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brobert83/cucumber_base_http_java8
Cucumber http steps library
https://github.com/brobert83/cucumber_base_http_java8
bdd cucumber http spring
Last synced: 3 days ago
JSON representation
Cucumber http steps library
- Host: GitHub
- URL: https://github.com/brobert83/cucumber_base_http_java8
- Owner: brobert83
- License: apache-2.0
- Created: 2020-09-18T14:30:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-18T23:21:13.000Z (over 4 years ago)
- Last Synced: 2024-11-15T22:29:11.724Z (2 months ago)
- Topics: bdd, cucumber, http, spring
- Language: Java
- Homepage:
- Size: 128 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cucumber HTTP steps
![Build](https://github.com/brobert83/cucumber_base_http_java8/workflows/Build/badge.svg?branch=master)
![Maven Central](https://img.shields.io/maven-central/v/io.github.brobert83/cucumber-http-java8)
![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)
![Lines of code](https://img.shields.io/tokei/lines/github/brobert83/cucumber_base_http_java8)**THIS LIBRARY IS VERY NEW, I'M NOT DONE WITH THE CORE YET, BUT IT'S USABLE**
This library aims to provide a bundle of Cucumber predefined steps to perform HTTP calls and perform verifications on the HTTP response.
There is a small test project demonstrating how to use this library here https://github.com/brobert83/cucumber_base_http_java8_springboot_test
### Visit the [WIKI](https://github.com/brobert83/cucumber_base_http_java8/wiki/home) for more information
# Basic setup
```xmlio.github.brobert83
cucumber-http-java8
0.1.2
test
```
### 2. Add the extraGlue
```java
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/bdd/resources/features",
plugin = {"pretty", "html:target/cucumber.html"},
extraGlue = {"io.github.brobert83.cucumber_http_java8"} // you cannot have both glue and extraGlue, be careful with this
)
public class CucumberTest {}
```## Steps provided
```gherkin
Given a '(.*)' request
Given the request body is '(.*)'`
Given the request has header '(.*)'='(.*)'
When the request is sent to '(.*)'
Then the server responds with status code '(.*)'
Then the response body matches '(.*)'`
Then the response has header '(.*)'='(.*)'
```## Reference doc
[Then the response body matches '(.*)'](src/main/java/io/github/brobert83/cucumber_http_java8/steps/response_body/HttpResponseBodyMatchStep.md)# Example
```gherkin
Scenario: Perform a GET requestGiven a 'GET' request
Given the request has header 'Content-Type'='application/json'
When the request is sent to '/resources/1'
Then the server responds with status code '200'
Then the response body matches '{"name":"Rob","status":"active"}'
Then the response has header 'Content-Type'='application/json'
```# General considerations
- This main intention for this library is to be used in conjunction with Spring/Springboot
- The mechanism used to create interoperability is Spring beans wiring