byte-physics / igortest

Igor Pro Universal Testing Framework
https://docs.byte-physics.de/igor-unit-testing-framework/
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Fix order of test case execution + Add shuffling of execution order #417

Closed Garados007 closed 1 year ago

Garados007 commented 1 year ago

The order of test case execution is now fixed and IUTF now always executes the test cases from the same test suite together. The execution of the test suites are now in that order they are listed in the RunTest call (or alphabetically if regex used).

The code of CreateTestRunSetup is now much simpler and contains less nested loops.

Close #416


The user can now shuffle the execution order of test suites and test cases. It is also possible to opt-out shuffling test cases in specific test suites.

The default execution order is documented alongside the new feature.

Close #375

Garados007 commented 1 year ago

@t-b @MichaelHuth Ready for review.

t-b commented 1 year ago

Nice one!

The shuffling options look good, I also like both levels (test suite and cases). The idea to skip a test suite is also a good.

Comments:

Garados007 commented 1 year ago

Fixed.

And who could have guessed? Testing randomness in Igor is pretty ... unpredictable. 😂 I needed special test cases for Igor 7 and 8. 🤷

t-b commented 1 year ago

Very nice solution with IsTagMatch.

Some comments regarding the tests:

+    // Restore seed to a "random" one
+    seed = DateTime * 1e-6
+    SetRandomSeed seed - floor(seed)

You don't need that. The random seed after a test case is not something anyone should care about.

TestHelper:

That helper looks mostly good. But it misses to check two crucial things. It currently passes when passing an empty expect wave. And it also passes if TestRunData has more entries than expect.

So I would add

CHECK_EQUAL_VAR(length, DimSize(wv, UTF_ROW))
CHECK_GT_VAR(lenth, 0)

to nail that down.

Always when writing a loop in a test, you need to ask yourself, "Is it okay if the loop is not executed at all?". And in many cases the answer is no, and thus the above checks are required.

Garados007 commented 1 year ago

Fixed.