Hi,

Is there a naming convention when writing the test classes, it has to be
ended with "Test" postfix, like "XxxxXxxTest.java" ?

I observed the following peculiar behavior when running test classes.

1. If the test package contain only one test class, it has to be named as
"XxxxXxxTest.java"

2. If the test package contains more than one test class *at least one of
them have to be* like "XxxxXxxTest.java".

If neither of the above requirements are met, surefire plugin *will not
pick* the test classes. I came across this situation because my test class
was named as XxxxXxx*Tests*.java and it was not picked up by the surefire
plugin.

This is mentioned in the Surefire
documentation<http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html>
.

"By default, the Surefire Plugin will automatically include all test
classes with the following wildcard patterns:

   - "**/Test*.java" - includes all of its subdirectories and all java
   filenames that start with "Test".
   - "**/*Test.java" - includes all of its subdirectories and all java
   filenames that end with "Test".
   - "**/*TestCase.java" - includes all of its subdirectories and all java
   filenames that end with "TestCase"."

But as we are using the TestNG with Surefire, we are suppose to have any
test class and point to it using testng.xml like below.

<test name="Flickr-Connector-Test" preserve-order="true" verbose="2">
        <classes>
            <class
name="org.wso2.carbon.connector.integration.test.flickr.FlickrConnectorIntegrationTests"/>
        </classes>
    </test>

This is also not working unless we have the above naming conventions.



Is this a known behavior ? Any idea why this is happening ?

-- 
Nalin Chamara
Software Engineer
071-56-147-56
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to