user2315104
user2315104

Reputation: 2722

execute goal mvn-failsafe-plugin: (failsafe-integration-tests) project x: suiteXmlFiles is configured, but there is no TestNG dependency

i am using maven failsafe plugin to execute the integration test cases along with cobertura plugin. in the configuration of failsafe plugin, i have given suiteXmlFile which has all the integration tests however, when run the following command , i am getting error command is : mvn cobertura:cobertura-integration -DskipITs=false and error is :

Failed to execute goal maven-failsafe-plugin:2.17:integration-test (failsafe-integration-tests) on project xx: suiteXmlFiles is configured, but there is no TestNG dependency

here is the snippet from pom.xml

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <version>2.17</version>
  <configuration>
    <suiteXmlFiles>
      <suiteXmlFile>/home/adam/coberturaint/reporting/src/test/resources/testng/it-test.xml</suiteXmlFile>
    </suiteXmlFiles>
    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.testng</groupId>
          <artifactId>testng</artifactId>
          <version>6.8.8</version>
        </dependency>
      </dependencies>
    </dependencyManagement>

  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>6.8.8</version>
    </dependency>
  </dependencies>

</plugin>

i am using fail-safe plugin version : 2.17

i have mentioned the dependency of testng everywhere, but still i am getting dependency error please suggest

regards

Upvotes: 0

Views: 1456

Answers (1)

khmarbaise
khmarbaise

Reputation: 97359

You need to go a different way cause the messages it already.

<?xml version='1.0' encoding='UTF-8'?>
<project
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.8</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.17</version>
          <configuration>
            <suiteXmlFiles>
              <suiteXmlFile>/home/adam/coberturaint/reporting/src/test/resources/testng/it-test.xml</suiteXmlFile>
            </suiteXmlFiles>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>

Apart from that you need to call maven like this:

mvn verify

to run the integration-test phase. If you call Maven like this:

mvn cobertura:cobertura-integration 

You have no life cycle which will not run the integration tests.

You should prevent using absolute paths in your pom file as you do with your suite file. The question is on the other hand why you need a suite file. In TestNG usually you don't need one.

Upvotes: 1

Related Questions