On Thu, Apr 10, 2014 at 2:57 PM, Nalin Chandraratne <na...@wso2.com> wrote:
Hi Nalin

> Hi,
>
> Is there a naming convention when writing the test classes, it has to be
> ended with "Test" postfix, like "XxxxXxxTest.java" ?
>
Yes. Usually we have a naming convention. Test class should be ended with "
TestCase" like "XxxxxxxTestCase.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 
> javafilenames that start with "Test".
>    - "**/*Test.java" - includes all of its subdirectories and all 
> javafilenames that end with "Test".
>    - "**/*TestCase.java" - includes all of its subdirectories and all 
> javafilenames 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 ?
>
Thanks for reporting this issue. I think this is an issue in surefire
plugging. Otherwise It should pick the test class since the test class name
is defined in testng.xml and the default configuration should be
 overridden("**/*Test.java").

Thanks,
Nuwanw

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


-- 
Nuwan Wimalasekara
Senior Software Engineer - Test Automation
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

phone: +94 71 668 4620
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to