Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Every test should only fail for one reason and only one test should fail for that reason.</p> <p>This helps a lot with writing a maintainable set of unit tests.</p> <p>I'd write a couple of tests each for ValidateUserDetails, ValidateUsername and ValidateUserPassword. Then you only need to test that CreateUser calls those functions.</p> <hr> <p>Re read your question; Seems I misunderstood things a bit.</p> <p>You might be interested in what J.P Boodhoo has written on his style of behaviour driven design. <a href="http://blog.developwithpassion.com/2008/12/22/how-im-currently-writing-my-bdd-style-tests-part-2/" rel="nofollow noreferrer">http://blog.developwithpassion.com/2008/12/22/how-im-currently-writing-my-bdd-style-tests-part-2/</a></p> <p>BDD is becoming a very overloaded term, everyone has a different definition and different tools to do it. As far as I see what JP Boodhoo is doing is splitting up test fixtures according to concern and not class.</p> <p>For example you could create separate fixtures for testing Validation of user details, Validation of username, Validation of password and creating users. The idea of BDD is that by naming the testfixtures and tests the right way you can create something that almost reads like documentation by printing out the testfixture names and test names. Another advantage of grouping your tests by concern and not by class is that you'll probably only need one setup and teardown routine for each fixture.</p> <p>I havn't had much experience with this myself though. </p> <p>If you're interested in reading more, JP Boodhoo has posted a lot about this on his blog (see above link) or you can also listen to the dot net rocks episode with Scott Bellware where he talks about a similar way of grouping and naming tests <a href="http://www.dotnetrocks.com/default.aspx?showNum=406" rel="nofollow noreferrer">http://www.dotnetrocks.com/default.aspx?showNum=406</a></p> <p>I hope this is more what you're looking for.</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