2

While executing my pom.xml file through maven test my BUILD is getting SUCCESSFUL but my testng.xml is not executing.

enter image description here

I tried with executing 13 classes and with single class for both the time it gives the same result. I don't know why it is copying 0 resource.

Please check my pom.xml below:

<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>
  <groupId>e-Pragati_App_Store</groupId>
  <artifactId>e-Pragati_App_Store</artifactId>
  <version>0.0.1-SNAPSHOT</version>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.12.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>3.12.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
  </dependencies>
</project>

Please follow my testng.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
    <test name="Usecase1">
        <classes>
            <class name="APp_Store.AddNewAppErrorMessages"/>
        </classes>
    </test>

</suite>
  • 1
    What is the full path to your testng.xml starting from project root? – Alexey R. May 25 '18 at 7:16
  • 1
    i too had same problem. its worked for me. i copied the file in resources. thanks @Aulis – Ameet Gondali Aparajit GovindD Feb 11 at 11:03
2

The testng.xml should be located in your test resources. That way the testng.xml will be copied. You can also configure surefire plugin to explicitly run testng suite xml files. Should your maven plugins be configured as plugins not dependencies? Also seems like you should have other dependencies in test scope as well.

Be sure to check that your test classes have postfix 'Test'.

0

Include maven surefire plugin end of the properties & before the dependencies. Use your "TestNG" XML file name.Use below code.

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M3</version>
        <configuration>
            <suiteXmlFiles>
                <suiteXmlFile>testng.xml</suiteXmlFile>
            </suiteXmlFiles>
        </configuration>
    </plugin>
</plugins>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.