Running Selenium(TestNG) tests from Azure Devops

Viewed 639

I'm working on running my automation test scripts (which is a Maven project based on java and using test ng ) in AzureDevops CI/CD pipeline. I have pushed all my code to Github and created a Maven task to run the tests.

But when I try to run the Maven task , it is not considering testng.xml, where I have all the tests configurations like which tests to be run(order of the tests) and other configuration stuff like listener to create some custom reports. It is just running all the test classes present in my complete Maven project.

Please help me which config / task I should in add in my build inorder for the test to run based on my testng.xml

Below is the Pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 TestAutomation Test 0.0.1-SNAPSHOT jar Test http://maven.apache.org
org.seleniumhq.selenium selenium-java 3.14.0 org.testng testng 6.11 compile org.apache.poi poi 3.16-beta2 com.relevantcodes extentreports 2.41.2 commons-io commons-io 2.6 log4j log4j 1.2.17 com.googlecode.json-simple json-simple 1.1.1

    <!-- for gson https://mvnrepository.com/artifact/com.google.code.gson/gson -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.6</version>
    </dependency>
</dependencies>  
<build>
    <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <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>
          <properties>
            <property>
              <name>listener</name>
              <value>com.qa.ExtentReportListner.ExtentRerportListener</value>
            </property>
            </properties>
        </configuration>
  </plugin>             
    </plugins>
 </build>

0 Answers
Related