Le 08/04/2010 01:33, Bob Morley a écrit :
Would anyone object if I renamed the junit tests if the Ofbiz project (and
related testdef)? I believe the standard for a test fixture in JUnit is to
name the class<ClassName>Test (as opposed to Tests) and each test method in
that class would be named testXYZ.
Ofbiz follows the method naming convention, but it appears we have named a
number of junit tests with the plural "Tests" at the end.
Why is this important? Some tools rely on these naming conventions to
determine which are tests and which are not. I am doing some work in this
area and what I wanted to be able to do is execute JUnit tests from with-in
Eclipse getting all of the IDE candy associated with that. From the
command-line we generate great code coverage metrics with Cobertura but
being pretty heavy into the Atlassian tool suite, I tend to use Clover when
running inside Eclipse. By using the standard naming conventions, these
tools pickup the unit tests properly and make developing Ofbiz in Eclipse
even nicer (without any impact to the project).
Anyone have any Cons to doing this?
Hi Bob,
the only thing I see with the tests, is that test files should not be at
the same directory level as the source code.
I think that we should have :
<component>/src/test
and not :
<component>/src/org/ofbiz/<component>/test
the only point in this change, is when doing code coverage, it's looking
for coverage on the tests, which is not the best idea.
But maybe someone with more knowledge would be able to tell if I'm right
or not...
For naming the tests, the only thing we need with JUnit 3.8, is to have
the test prefixed with test. It's true for minilang tests as well.
Cheers,
--
Erwan de FERRIERES
www.nereide.biz