You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Daan Hoogland <da...@gmail.com> on 2014/02/07 13:27:13 UTC
[DISCUSS]atomic unit tests
LS,
I had a discussion on uniq paths and unit tests yesterday night with
our new colleague Miguel about the unit tests that we have in
Cloudstack at the moment. He pointed me to a common smell that I
overlooked so far in Cloudstack.
A lot of times unit tests are organised as folows:
class test{
@Before
someInitThingies(){}
someTest(){}
someOtherTest(){}
@Test
doTheStuff(){
someTest();
someOtherTest();
}
}// end of unit test class
this (anti) pattern defeats the purpose of unit testing a bit. You
will not get report on the individual use cases of your methods. I
would call upon all to implement the class as folows:
class test{
@Before
someInitThingies(){}
@Test
someTest(){}
@Test
someOtherTest(){}
}// end of unit test class
ASAIROCS there is no pattern or use that justifies putting the test
methods in a common placeholder. This is up to the test framework and
it needs it to give usefull debugging reports.
any thoughts/comment welcome
--
Daan