0

I have a test code deployed to antifactory Based on this Guide to using attached tests I want to invoke that test from plugin

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>

The test code is included as part of dependency

<dependency>
  <groupId>org.myproject</groupId>
  <artifactId>tests</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.myproject</groupId>
  <artifactId>tests</artifactId>
  <type>test-jar</test>
  <scope>test</scope>
</dependency>

maven failsafe plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.22.2</version>
    <scope>test</scope>
    <configuration>
      <dependenciesToScan> 
        <dependency>org.myproject:tests</dependency>
      </dependenciesToScan>
    </configuration>
    <executions>
      <execution>
        <goals>
           <goal>integration-test</goal>
           <goal>verify</goal>
        </goals>
      </execution>
    </executions>
</plugin>

I am trying to invoke mvn command as

mvn clean verify -Dit.test=com.myproject.TestRunner

I am getting the error as

integration-test: (default) on project testproject: No test where executed!

Now how do I make the maven-failsafe-plugin to call the class inside the dependency jar

--- EDIT ---

as a workaround I unzip the jar from .m2 folder to the local folder path target/test-classess then it picks up the compiled code .class files and testing is working

Dickens A S
  • 3,824
  • 2
  • 22
  • 45
  • 1
    Why would you like to call the tests within an packaged jar? Why not doing the test from the project which has packaged them? – khmarbaise Apr 19 '22 at 12:13
  • Check out this https://stackoverflow.com/questions/10496846/run-junit-tests-contained-in-dependency-jar-using-maven-surefire/17061755#17061755 it is for surefire, but maybe for failsafe similar feature exists. – jwpol Apr 19 '22 at 12:18
  • @jwpol dependenciesToScan is not working I tried id – Dickens A S Apr 21 '22 at 06:31
  • @khmarbaise that is the requirement, dependenciesToScan was provided by the failsafe plugin but it does not have the capacity use it, may be it is not programmed that way – Dickens A S Apr 21 '22 at 06:33
  • `failsafe plugin but it does not have the capacity use it, may be it is not programmed that way`??? Please show your full pom file and the calling...which Maven version and surefire/failsafe plugin versions you are using? – khmarbaise Apr 21 '22 at 07:12
  • 2.22.2 added in the question maven 3.8.1 – Dickens A S Apr 21 '22 at 09:06

0 Answers0