question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HoverflyRule doesn't export simulations for multiple tests

See original GitHub issue

When HoverflyRule is annotated with @Rule, the exportSimulation is called after each test, meaning that, it will keep overwriting old captured data because of the same filename.

The solution could be postfixing the file name with the test class names, so that

@Rule
public HoverflyRule hoverflyRule = HoverflyRule.inCaptureMode("booking_service_test.json")

@Test 
public shouldGetBooking() {
}

@Test
public shouldDeleteBooking() {
}

should create two files under test/resources/hoverfly

  • booking_service_test_shouldGetBooking.json
  • booking_service_test_shouldDeleteBooking.json

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ia3andycommented, Mar 23, 2018

@tommysitu I will focus on the multiple requests issue, and then if I still got time propose a PR for this one too 😉

0reactions
tommysitucommented, Mar 23, 2018

@ia3andy That’s a very nice workaround! Would be good to add your solution to the project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JUnit — Hoverfly Java 0.4.2 documentation
You can create a Hoverfly Rule that is started in capture mode if the simulation file does not exist and in simulate mode...
Read more >
Easy API simulation with Hoverfly JUnit Rule - SpectoLabs
We build tools that simplify testing throughout the software delivery pipeline.
Read more >
Hoverfly Java Documentation - Read the Docs
... simulations, and a JUnit integration for using it within JUnit tests. ... public static HoverflyRule hoverflyRule = HoverflyRule.
Read more >
Issues · SpectoLabs/hoverfly-java · GitHub
[0.14.0] Working directory doesn't seem to be relative to workspace directory ... HoverflyRule doesn't export simulations for multiple tests enhancement.
Read more >
Easy API Simulation with Hoverfly JUnit Rule - OpenCredo
@Rule public HoverflyRule hoverflyRule = HoverflyRule.buildFromClassPathResource("test-service.json").build();. The rule takes a convention over ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found