If statements in tests considered harmful
Control flow statements and conditionals are obviously a big part of writing code. Without them, software tends to be very linear and boring - and this is exactly what you want in your tests.
Using conditional statements implies that there is more than one possible outcome or that there is more than one possible input for that flow - this should never be the case in software tests.
Good tests are inherently deterministic and linear. There should be only one input and one possible outcome. If you are trying to validate your results, you should use assertions and not control flow statements.
The use of control flow in tests is usually done to handle non-deterministic elements such as unknown system state, time, and external dependencies. You should always do your best to try and isolate your tests from these free radicals. Write self-contained tests that create and delete their own data, hack the calendar to work to your advantage, and use mock services instead of external dependencies. Follow the ‘if’s in your tests to identify the deeper issues that hide behind them.