Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaying a Seed for ScalaCheck does not work as expected. #2225

Open
khalid-reid-axisgroup opened this issue Feb 10, 2023 · 2 comments
Open

Comments

@khalid-reid-axisgroup
Copy link

Replaying a ScalaCheck does not produce the data causing the original failure. I've written up an explanation and a sample project to reproduce the problem here.

@cheeseng
Copy link
Contributor

@khalid-reid-axisgroup I think it is related to this:

scalatest/scalatestplus-scalacheck#60

I'll try to see if I can get it merge and release a new version for scalatest+scalacheck for it.

@khalid-reid-axisgroup
Copy link
Author

Thanks @cheeseng. I tried the solution you suggested and it works. See below:

[info] MyTest:
[info] - should work *** FAILED ***
[info]   TestFailedException was thrown during property evaluation.
[info]     Message: "[]" was not equal to "[1]"
[info]     Location: (MyTest.scala:15)
[info]     Occurred when passed generated values (
[info]       arg0 = Foo("", 280813621)
[info]     )
[info]   Init Seed: -4690408743289064788
[info] Run completed in 294 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***

Then set the seed:

[IJ]set ThisBuild/Test/testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-S", "-4690408743289064788")

Then replay it:

[IJ]test
Foo(,280813621)
[info] MyTest:
[info] - should work *** FAILED ***
[info]   TestFailedException was thrown during property evaluation.
[info]     Message: "[]" was not equal to "[1]"
[info]     Location: (MyTest.scala:15)
[info]     Occurred when passed generated values (
[info]       arg0 = Foo("", 280813621)
[info]     )
[info]   Init Seed: -4690408743289064788
[info] Run completed in 295 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***

The generated data is now the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants