Add option to shuffle test execution order - #1041
Conversation
This commit adds the option to pass the shuffle_tests Unity option to the test runner configuration. Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com>
Test suites can sometimes pass or fail depending on the order test cases happen to run in — usually a sign of a hidden dependency between tests. Enabling :unity ↳ :shuffle_tests randomizes execution order for a test executable each run, making that kind of bug easier to catch. The seed can be pinned with :test_runner ↳ :rng_seed for a reproducible order when tracking down a specific failure. Adds the configuration default, unit coverage for the settings' path through Configurator, a system test exercising randomized ordering end to end, and reference documentation for both options.
b6242be to
d1afaab
Compare
|
Thanks @jamestiotio. Pulling this into the 1.2.0 work now with some additional complementary changes. Once CI passes, we'll merge this. After the merge, I am also going to mesh this together with Ceedling's newly restored (in 1.2.0) delta builds. Ceedling is once again smart enough to skip unnecessary file regeneration, compiling, linking, and test suite running. That poses a small challenge for randomly ordered tests. In the current scheme, if no files have changed, there's no need to re-run a test suite. I am going to add an option that allows a delta build to still force a test suite re-run and to force that option when test shuffling is enabled so that every test build exercises randomly ordered test cases. The first 1.2.0 prerelease should be coming out maybe this week. |
A fixed random seed's exact shuffle output depends on the C library providing rand(), which varies by platform. With only a handful of test cases, a given seed can coincidentally reproduce the original declared order on some platforms even though shuffling is working correctly, which is exactly what happened on macOS. Raises the test count so the odds of that coincidence are negligible, and checks several distinct seeds together rather than one, asserting that shuffling produces variation somewhere among them rather than requiring every pair to differ.
6424b4f to
8f3bec6
Compare
0836d57
into
ThrowTheSwitch:pr-1041-shuffle-tests
Brings in the actual shuffle_tests feature content that a stale local branch reference caused to be missed in the prior next_version merge.
This commit adds the option to pass the
shuffle_testsUnity option to the test runner configuration.This depends on ThrowTheSwitch/Unity#714.