cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daan Hoogland <daan.hoogl...@gmail.com>
Subject [DISCUSS]atomic unit tests
Date Fri, 07 Feb 2014 12:27:13 GMT
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

Mime
View raw message