[jbosstools-dev] Should we use @Ignore in non-runnable JUnit test classes, instead of <include> in pom? (was: JUnit Tests)
Xavier Coulon
xcoulon at redhat.com
Fri Jan 23 03:22:58 EST 2015
What about using <excludes> to ignore the Abstract*.class and other similar classes [1] ?
I don't use any TestSuite class in the JAX-RS tooling component ofJBoss Tools, because I think it's an unnecessary pain to have to maintain an extra/accurate list of all the test classes that need to be run. And I like that some test methods or even test classes can be skipped with the @Ignore annotation.
[1] Here's what I have in my pom.xml:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*TestCase.class</include>
</includes>
<excludes>
<exclude>**/Abstract*.class</exclude>
</excludes>
</configuration>
</plugin>
Best regards,
/Xavier
> On 22 Jan 2015, at 20:51, Nick Boldt <nboldt at redhat.com> wrote:
>
> No, because then AbstractTest* and TemplateTest* classes would run, and
> they shouldn't be.
>
> You can set your own <include> entries in your root pom. Then all your
> projects' tests will inherit those new rules.
>
> --
>
> We may also have some older JUnit 3 tests (from the JDK 1.4 era?) that
> might still be set to run with older JRE environments, where
> @annotations are not supported.
>
> If I'm wrong on that, and we no longer support running tests w/ old
> runtimes, then yes, we could consider adding @Ignores to all the tests
> which shouldn't be run, instead of using the "All" and "Suite" naming
> conventions.
>
> --
>
> I've cc:'d the jbosstools-dev list because a wider audience might be
> able to comment better on if it's time to move to using @ignore instead
> of using restrictive patterns when running JUnits w/ Surefire in
> Tycho/Maven builds.
>
> N
>
> On 01/22/2015 02:08 PM, Daniel Florian wrote:
>> Guys,
>>
>> We currently have to add each JUnit test class to a test suite file called AllTests.java. If a test does not get added to this test suite it does not get run.
>>
>> I think the pom has this:
>>
>> <includes>
>> <include>**/AllTests.class</include>
>> <include>**/*AllTests*.class</include>
>> <include>**/*AllBotTests*.class</include>
>> <include>**/*TestSuite*.class</include>
>> </includes>
>>
>> Could we add:
>>
>> <include>**/Test*.class</include>
>> <include>**/*Test.class</include>
>>
>> So that we wouldn't need an AllTests.java. Other projects can keep using the test suite approach.
>>
>> With JUnit's @Ignore it is easy to stop a test from being run.
>>
>> wdyt?
>>
>> Thanks,
>>
>> Dan
>>
>
> --
> Nick Boldt :: JBoss by Red Hat
> Productization Lead :: JBoss Tools & Dev Studio
> http://nick.divbyzero.com
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20150123/ea0cb3e0/attachment-0001.html
More information about the jbosstools-dev
mailing list