You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I force an order to the execution of test cases with the new ZTEST api?
This is one of the most popular question I've seen being asked on various discord's channels, PRs and issues.
From my understanding a TL;DR answer is:
You really shouldn't tweak with the ordering. By definition tests should be independent from each other, hence the ordering shouldn't matter. If it does matter it most like means your tests are not compliant with the definition of a "unit test". If the ordering matters you might better combine your tests into a single one since they are not independent beings.
Obviously, there are many corner cases and the topic is quite complex, hence one answer doesn't suite all questions. This discussion was started to have a common place to direct when someone is asking about the test order. One should also be able to find here tips and tricks on how to disentangle their test cases and be able to refactor a test suite in a way that test cases order won't matter.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
How can I force an order to the execution of test cases with the new ZTEST api?
This is one of the most popular question I've seen being asked on various discord's channels, PRs and issues.
From my understanding a TL;DR answer is:
Obviously, there are many corner cases and the topic is quite complex, hence one answer doesn't suite all questions. This discussion was started to have a common place to direct when someone is asking about the test order. One should also be able to find here tips and tricks on how to disentangle their test cases and be able to refactor a test suite in a way that test cases order won't matter.
Beta Was this translation helpful? Give feedback.
All reactions