You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Davide Giannella <gi...@gmail.com> on 2014/04/04 14:37:05 UTC

[trivia] unit test class length

Good afternoon everyone,

normally I tend to group all the unit testing per class of coverage. For
example all the unit tests related to a class named FooBar will be in a
class named FooBarTest. So far so good, it gives me a quick
understanding of what I am looking at.

Now I have some test classes that reaches the heights of 3k lines. IMO
worth the effort of splitting those in multiple classes for better
maintenance an reading.

Do we have any (in)formal rules around this topic? Do anyone think I
should not split the tests in separate classes?

Cheers
D.



Re: [trivia] unit test class length

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Apr 4, 2014 at 3:35 PM, Davide Giannella
<gi...@gmail.com> wrote:
> ...it could be that I'm paranoid and test every single bit ;)...

I don't remember how many times I thought I was being paranoid with
tests, and later saw my paranoid tests expose very stupid bugs ;-)

-Bertrand

Re: [trivia] unit test class length

Posted by Davide Giannella <gi...@gmail.com>.
On 04/04/2014 13:48, Michael Dürig wrote:
> ...
> OTHO the size of the test class might be an indicator that the class
> under test has to many responsibilities and should be split up by itself.
Or it could be that I'm paranoid and test every single bit ;)

D.



Re: [trivia] unit test class length

Posted by Michael Dürig <md...@apache.org>.
Hi Davide,

I wouldn't split just because you reached 3k (or any number of lines of 
code). Since a unit test is just a collection of tests there is (should 
be) no further dependency between the various tests beyond belonging to 
the same unit under test. Thus the number of lines it not a good measure 
for code complexity in this case. I'd even find in more confusing if I'd 
have to look through various classes because the tests have been 
arbitrarily split up.

OTHO the size of the test class might be an indicator that the class 
under test has to many responsibilities and should be split up by itself.

Michael


On 4.4.14 2:37 , Davide Giannella wrote:
> Good afternoon everyone,
>
> normally I tend to group all the unit testing per class of coverage. For
> example all the unit tests related to a class named FooBar will be in a
> class named FooBarTest. So far so good, it gives me a quick
> understanding of what I am looking at.
>
> Now I have some test classes that reaches the heights of 3k lines. IMO
> worth the effort of splitting those in multiple classes for better
> maintenance an reading.
>
> Do we have any (in)formal rules around this topic? Do anyone think I
> should not split the tests in separate classes?
>
> Cheers
> D.
>
>