Note that there are some explanatory texts on larger screens.

plurals
  1. POIntegration tests, unit tests and code coverage
    primarykey
    data
    text
    <p>I was reviewing some code for a colleague and came across a test in the unit test class that looked this:</p> <pre><code>// setup Foo f = ... FooToBarConverter ftb = ... Bar b = ftb.Convert(f); // It is easier to create a Bar by converting it from a Foo than making one 'from scratch' // test systemUnderTest.DoSomething(bar); // assert Assert.IsTrue(...) </code></pre> <p>Clearly this is an integration test as it is testing the FooToBarConverter as well as the system under test as it is the only test that covers the DoSomething() method. I suggested moving this test to an integration test solution, however this reduces the code coverage of the unit tests. We are aiming for 100% unit test code coverage (and yes - I know that 100% coverage is a means to an end not the end itself, and 100% covered code is not necessarily 100% correct code).</p> <p>Is there a reason for creating unit tests to bring the coverage back up if we move the integration test out? </p> <p>Or are we aiming for the wrong thing with 100% unit test coverage? Should we be aiming for 100% coverage with the combination all our tests (or even aiming for 100% at all)?</p> <p>Thank you.</p> <p>EDIT/UPDATE:</p> <p>This is not a question about how to unit test the system under test properly (I know the reasons that this is not a unit test, and I know how to properly convert it into a unit test), nor is it a question on coverage on FooToBarConverter. I want opinions on code coverage on the system under test: are integration tests on the system under test sufficient? or should there also be unit tests?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload