Mike, after thinking about this some more, I guess there are 2 different
test needs here -
1) allow some tests to be skipped due to a boolean condition (like if
the test is running on DB2), which OPENJPA-998 provides via the @Ignore
annotation
2) convert the surefire excludes list in pom.xml into annotations, via
an @Optional or similar system property, as you suggest below and could
use OPENJPA-949 for the JIRA work.
I support renaming @AllowFailure to something like @Optional which uses
a system property as the default activator. Besides the default
all/true or none/false conditions, we could also support a
package/classname value like -
-Dopenjpa.optional.tests=org.apache.openjpa.persistence.query.*
to allow running a subset of the normally excluded tests.
I would also check the @Optional annotation before the @Ignore
annotation, so these non-normal tests will be skipped before the
conditional code (usually in setup()) is run for the @Ignore.
-Donald
Donald Woods wrote:
I would rather see us use a Junit v4 annotation like @Ignore as provided
via OPENJPA-998 (which just needs someone to review and commit it...)
/**
* Signals to the harness to ignore the annotated test.
*
*/
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface Ignore {
boolean value() default true;
String message() default "";
}
After the above is added, the @AllowFailure support can be removed and
the ClassSelector.java updated to look for @Ignore by default.
-Donald
Michael Dick wrote:
Hi all,
The AllowFailure annotation is very useful in that it allows specific
test
methods to be ignored during a typical Maven build.
The implementation, however is rather confusing as a "clean" build of
OpenJPA will typically contain several stack traces from exceptions.
Running
these optional tests that currently do not pass just consumes CPU cycles
that could be better spent elsewhere.
I propose refactoring @AllowFailure to be called @OptionalTest (or just
@Optional) and updating the supporting methods in PersistenceTestCase so
that test methods (or classes) annotated with @OptionalTest are skipped
unless a jvm system property is true (ie -Dopenjpa.optional.tests=true).
I think this will save everyone's CPU cycles without violating the
intent of
@AllowFailure. In addition with this change we could resurrect the
changes
for OPENJPA-770 and we could clean up the root pom.xml a bit.
Anyone else have strong opinions about @AllowFailure?
-mike