O'Reilly logo

Testing with F# by Mikael Lundin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tests that require excessive setup

A slight indication that your system under test is too complex is that the test setup becomes excessive. The easiest way to identify this is when you have 20 lines of setup code in order to run one line of test code. Some of it you might also need to tear down after the test is complete.

The test itself doesn't have to be very complex, but the complexity of the system under test forces the excessive setup on the test. What often happens is that this setup is duplicated from test to tests, causing a lot of duplicated code. The most commonly seen solution is then to extract the method once the test is set up, but this is really bad. Instead, the problem should be addressed in the system under test.

The excessive ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required