If there is a test that fails only sometimes, can I ask sbt to run tests continually until failure?
Otherwise, I'm stuck hitting up-arrow while watching Arrow. (pun unintended but leavening)
https://stackoverflow.com/q/22366719/1296806
A failing test is a test that fails consistently across multiple reruns A flaky test is a test that eventually passes across reruns if the test reruns multiple times We wanted to create a system that would detect flaky tests and calculate flakiness percentage based on the test history.
Flaky tests are statistical by nature, so you’ll need to follow a test over a few days to understand its behavior. The more it runs, the more likely a pattern will emerge.
Leave the flaky tests branch alive and building until no repeating flaky test appears for a longer period of time. A popular solution that hides flaky test failures is to re-run the failed tests a few times until they pass. If a test passes at least once, it is declared as passed.
These flaky tests have to be maintained regularly for every test done or have feedback loops so that every steps or change of the tests are done correctly. These maintenances or feedback loops usually end up slowing down the process of development drastically.
Old question, but having just had the same need myself, here is a solution: sbt will return non-zero exit code if you run it one off with the tests, so, one way to loop until it fails is to just look at the exit code in the shell:
while [ $? -eq 0 ]; do sbt test; done
I had the same problem, and I've ended up implementing this as a command.
lazy val root = Project("test", file(".")).
settings(commands += Command.command("testUntilFailed") { state =>
"test" :: "testUntilFailed" :: state
})
The advantage is that it will skip the SBT loading. You can also add extra parameter or run testOnly
to test a single test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With