Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hmm, I hope I do not fail you by mentioning things you rather have unmentioned. But here my 2 cents on it. One disclaimer up-front. I use <code>nunit</code> with <code>RhinoMocks</code>, so syntax could be different, concepts are the same though.</p> <p><strong>Yes, you need separate tests</strong>. You can debate if you want to store the tests in the same test class, and tag them with <code>[Category("integrationtest")]</code> so that you can easily run your unit tests without running integration tests, and the other way around. With your TDD practices (oops, I know you don't want me talking about that :)) you need your unit tests to be completed as fast as possible.</p> <p>To look at this from a slightly different angle; you are not really duplicating your tests. Your integration tests validate the functionality, while your unit tests validate a method in isolation. So they can very well have completely different names. As long as they make sense to you (or if you develop something with a team: as long as it makes sense for your team).</p> <p>I think the most important thing is that you find a way that works for you. There isn't really a right or wrong. I think it's a big plus that you are writing both unit tests and integration tests. How you organize them is kinda up to you. I had different approaches in different projects I participated in:</p> <p>Project A:</p> <ul> <li>1 test class for integration tests </li> <li>1 test class for unit tests</li> </ul> <p>That helped to create meaningful names for the test classes, they could capture the actual feature we are testing. As for the unit tests, the test class had the same name as the class that we are testing. </p> <p>Project B:</p> <ul> <li>Mixed up integration tests with unit tests in one test class. </li> </ul> <p>This worked fine as well, although we sometimes did have trouble finding an integration test. But tbh, with resharper at your side, how hard can it be :).</p>
 

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