I have an ordered test that have some tests that run properly.
My problem is that during the test execution I can't see which test is running. How can I monitor the execution of the ordered tests?
I have an ordered test that have some tests that run properly.
My problem is that during the test execution I can't see which test is running. How can I monitor the execution of the ordered tests?
I'd be brave and say you are doing this wrong.
Tests should be simple, self-sufficient, small, and independent.
The reason for being independent is that you may not reliably and continuously guarantee the order of execution in a real program. Usually you'd have several developers working on the same project who can mess up the indented call order.
An alternative approach will be to refactor dependencies between tests into a single test, like this
// From
Test A -> Test B -> Test C
// To
Test ABC
Calling A
Calling B
Calling C
Another approach will be to use TestSetup
and TestTearDown
, e.g:
Test B
Calling TestSetup(run A)
Calling B
Calling TestTearDown(run C)
Visual Studio supports ordered tests as explained here.
You have to add an
Ordered Test
to your solution which can contain actual unit tests. Within the ordered test, you can define which test is executed in which order.If you want to view some progress indication while your tests run you can always report it to the Visual Studio output window using e.g.