sageserpent-open / americium

Generation of test case data for Scala and Java, in the spirit of QuickCheck. When your test fails, it gives you a minimised failing test case and a way of reproducing the failure immediately.
MIT License
15 stars 1 forks source link

Replaying a test case created via a timed strategy leaves the test running for a potentially long time. #69

Closed sageserpent-open closed 6 months ago

sageserpent-open commented 9 months ago

NOTE: this applies not to test case reproduction via a recipe or recipe hash, but to explicit replay via JUnit5, typically by clicking on a trial shown in an IDE's test output window, eg. IntelliJ or Visual Studio Code.

If a test cases are produced using a timed strategy, then because JUnit5 performs the replay by playing every single test case and filtering under the hood to get the one we want to replay, then even after the desired test case has been replayed, then regardless of the outcome of its trial, JUnit5 ploughs on regardless, and the test appears to hang until the time limit is breached.

Is there some way of finishing after the test case has been run that won't break the usual case of running as many trials as possible?

sageserpent-open commented 6 months ago

Based on the outcome of #66, this looks unlikely. If there was a way of accessing the full Uniqueid passed to JUnit via a LauncherDiscoveryRequest, then yes, but JUnit doesn't expose that to extensions to the best of my knowledge.

sageserpent-open commented 6 months ago

Asked a question about this on Stack Overflow just in case...

sageserpent-open commented 6 months ago

Fixed by work done for #66 .

Evidence from Kinetic Merge, upgraded to use Americium 1.19.0 at Git commit SHA: 09dd23d38056cbc08b64953eb952f931c49db40d.

Running a test using a time strategy of 5 minutes:

Screenshot 2024-03-07 at 15 38 54

Observe trial 37 and the outcome, also note the times for the overall test and the individual trial.

Direct replay of trial 37:

Screenshot 2024-03-07 at 15 39 29

Observe trial 37 and the outcome, also the times of the overall suite and the single directly replayed test within it - the test suite does not take 5 minutes.

sageserpent-open commented 6 months ago

Job's a good 'un.