naver / fixture-monkey

Let Fixture Monkey generate test instances including edge cases automatically
https://naver.github.io/fixture-monkey
Apache License 2.0
561 stars 89 forks source link

Print seed if test fails in JUnit #990

Closed seongahjo closed 1 month ago

seongahjo commented 3 months ago

Describe the feature you request

It is hard to generate a same instance of a type in Fixture Monkey, because it generates an arbitrary instance of the type. But if you use a same seed, you can easily reproduce a same instance of the type.

Fixture Monkey now supports the seed option as shown below.

  FixtureMonkey.builder()
            .seed(XXXX)
            .build()

The problem is that we do not know what the seed is. Fixture Monkey needs a way to print seed if the test fails. It needs the support of a test framework, JUnit.

Suggest A Solution

Add an JUnit Extension implements AfterTestExecutionCallback interface that prints the seed if the test fails.

codesejin commented 3 months ago

Hello, I'm interested in this open-source project. If this issue hasn't been addressed yet, may I take a shot at solving it?

seongahjo commented 3 months ago

@codesejin Sure. Please let me know if you have any problems in resolving this.

seongahjo commented 2 months ago

@codesejin Hello, are there any updates?

codesejin commented 2 months ago

@seongahjo

Hello, I apologize for the delay in progress. I have made the necessary updates, but I would greatly appreciate it if you could verify the approach. I’m not entirely sure if I’m approaching this correctly, so your feedback would be invaluable. 😅

1010

seongahjo commented 1 month ago

The issue is closed as it has been fixed since 1.0.24.