Using custom Java annotation in pom.xml with failsave

131 Views Asked by At

I created a custom Java annotation

@Tag("webservice")
public @interface WebserviceTest {
    boolean executeAndIgnoreCondition() default false;
}

Furthermore I created Java test with this annotation. Now I would like to run failsave but only tests with my annotation 'WebserviceTest' should be tested.

I tried a lot but nothing was ok. My last example:

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>
                            integration-test
                        </goal>
                        <goal>
                            verify
                        </goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includes>
                    <include>**/Test*.java</include>
                </includes>
                    <groups>webservice</groups>
            </configuration>
        </plugin>

If I annotate my tests with

@Tag("webservice")

everything is fine but I need to annotate my test with @WebserviceTest. How does it work?

Thanks a lot

1

There are 1 best solutions below

0
On

Finally I found the solution. You have to add

@Retention(RetentionPolicy.RUNTIME)

to the annotation