Some unit testing modules allow you to specify a setup code that runs before the actual test begins.
This allows you to get the target in the correct state before running the test. Thus, your test may fail or fail based on the specific code you are testing, and not on the code necessary before you can run the test.
As a result, your test sequence will end approximately like this:
Test1: LoadGasoline, Assert Test2 Setup: LoadGasoline Test2: InsertKey, Assert Test3 Setup: LoadGasoline, InsertKey Test3: StartEngine, Assert Test4 Setup: LoadGasoline, InsertKey, StartEngine Test4: Go, Assert
Actually, since all tests are performed sequentially, there is no chance that Test Setup will fail if the previous test passes.
With that said, you should also check for failures that shouldn't work, but that is another problem.
source share