Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-180

BMUnit jar config stops JUnit tests working under maven

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0
    • 1.6.0
    • Contrib
    • None
    • Workaround Exists
    • Hide

      If you want to run JUnit tests using BMUnit then declare the dependency as follows

      <dependency>
      <groupId>org.jboss.byteman</groupId>
      <artifactId>byteman-bmunit</artifactId>
      <scope>test</scope>
      <version>${byteman.version}</version>
      <exclusions>
      <exclusion>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      </exclusion>
      </exclusions>
      </dependency>

      Show
      If you want to run JUnit tests using BMUnit then declare the dependency as follows <dependency> <groupId>org.jboss.byteman</groupId> <artifactId>byteman-bmunit</artifactId> <scope>test</scope> <version>${byteman.version}</version> <exclusions> <exclusion> <groupId>org.testng</groupId> <artifactId>testng</artifactId> </exclusion> </exclusions> </dependency>

      The BMUnit jar byteman-bmunit.jar is built using a pom which declares a dependemcy on both JUnit and TestNG. If the BMUnit jar is declared as a maven dependency and used to run tests from maven the surefire plug-in detects the recursive dependency on the TestNG jar and assumes that all tests in the test directory are TestNG tests. As a result surefire ignores test classes annotated with JUnit test annotations.

      It is possible to get round this by importing the BMUnit jar with an exclusion for the TestNG jar. However, a better solution would be to build the BMUnit jar with an optional dependency on TestNG (and JUnit), requiring the test pom to import whichever tets jar it needs.

            rhn-engineering-adinn Andrew Dinn
            rhn-engineering-adinn Andrew Dinn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: