vendredi 21 février 2020

JUnit5-Jupiter: Composed (="meta") annotation does not resolve to annotation definition

I defined my own JUnit annotation:

@ParameterizedTest
@MethodSource("myorg.qa.ccrtesting.DataProviders#standardDataProvider")
@Tags({@Tag("ccr"), @Tag("standard")})
public @interface CcrStandardTest {
}

Then, I was able to use that annotation in my tests:

@CcrStandardTest
public void E0010_contact_standard (String testData) {
...
  • My run configuration:
    JVM options: -ea
    Class: myorg.qa.ccrtesting.ccrstandardtests.CcrStanConTest - This was suggested by the IDE (and is verified to point to the correct class, which holds my prototype test method)

However, this results in: jupiter.api.extension.ParameterResolutionException: No ParameterResolver registered for parameter [java.lang.String arg0] in method [public void...

  • I tried removing String testData from the test method signature but then JUnit is not executing any tests: No tests found

  • When I add @Test above my prototype test method, it executes but:

    1. It seems like none of the annotations I defined under @CcrStandardTest are applied
    2. IDE suggests suspicious combination @Test and parameterized source
      (I already know @ParameterizedTest implies @Test, just not sure why IDE is able to find the custom annotation but JUnit isn't?)




Aucun commentaire:

Enregistrer un commentaire