maxvetrenko / checkstyle

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
http://checkstyle.sourceforge.net/
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Update for existing Check: NameConvensionForJUnit4TestsClassesCheck #16

Closed maxvetrenko closed 10 years ago

maxvetrenko commented 10 years ago

https://github.com/maxvetrenko/sevntu.checkstyle/blob/NameConvensionForTests/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/NameConvensionForJUnit4TestsClassesCheck.java

This Check have to cover JUnit3 name convention.

romani commented 10 years ago

Test classes are named starting with the name of the class they are testing, and ending with Test. For example, HashTest or HashIntegrationTest.

Checkstyle have no ability to distinguish Test class from any other. There numerous UTs libraries: http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#Java , Junit is the only one of them. You will never support or distinguish Test class from from business logic classes. It is even non trivial task for human.

maxvetrenko commented 10 years ago

If Checkstyle can't cover JUnit3 naming convention, is it has any reason to include JUnit4 into Checkstyle confiig? Google has a lot of JUnit3 tests in it's projects and we'll have a lot of false positive on method names.

So, we can't cover a part ClassNames with Test classes.

romani commented 10 years ago

In Google Style there is not a word about Junit!! Junit is one from big number of testing frameworks.

Nobody claimed that Tests have to be in JUnit only. Developer can choose any testing framework he wants.

That part of rule can not be enforced by Checkstyle at all. Please close this issue.