https://github.com/spectolabs/hoverfly-jrecorder
Filter which intercepts http requests and outputs them into a hoverfly json file
https://github.com/spectolabs/hoverfly-jrecorder
Last synced: 12 months ago
JSON representation
Filter which intercepts http requests and outputs them into a hoverfly json file
- Host: GitHub
- URL: https://github.com/spectolabs/hoverfly-jrecorder
- Owner: SpectoLabs
- License: apache-2.0
- Created: 2016-03-04T11:35:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-07T14:58:34.000Z (over 10 years ago)
- Last Synced: 2025-06-25T01:12:35.607Z (about 1 year ago)
- Language: Java
- Homepage:
- Size: 22.5 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
**java-hoverfly-exporter**
-----------------
##Quick start
Simply add the filter to your tests (MockMvc in this example) `hoverflyFilter`:
```java
private static HoverflyFilter hoverflyFilter = new HoverflyFilter("www.my-test.com", "generated/hoverfly.json");
@Before
public void setUp() {
this.mockMvc = webAppContextSetup(webApplicationContext)
.addFilter(hoverflyFilter)
.build();
}
```
The filter takes the baseUrl which you wish your virtualized version of this service to have, and the directory you want the `.json` file to be output to. When you run the tests you will get a json output containing the recordings in a format of:
```java
[{
"request": {
"path": "/api/bookings",
"method": "POST",
"destination": "www.my-test.com",
"query": null,
"body": ""
},
"response": {
"status": 400,
"body": "",
"headers": {}
}]
```
You can then import the filter into hoverfly, for example using the hoverfly junit rule in your api consumer unit tests.
##Maven
```xml
io.specto
hoverfly-jrecorder
0.1.2
```