Cannot pass parameter from xml suite to test
Im new to maven and testng I got an issue: I cannot get parameter from
suite xml file for my test when run Maven Test I dont know why Can anyone
help me on this I appreciate so much
Thank you
This is my main test: hTest.java
package demo;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class hTest {
@Parameters({"user"})
@Test
public void getUser(String user)
{
System.out.println("NAME= " + user);
}
}
This is my suite hTest.xml
<?xml version="1.0" encoding="UTF-8"?>
<suite name="hTest" verbose="3" parallel="false">
<test name="hTest">
<parameter name="user" value="Giao"/>
<classes>
<class name="demo.hTest"/>
</classes>
</test>
</suite>
This is my pom.xml
<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>test</groupId>
<artifactId>sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>BnS</name>
<properties>
<test.suite.dir>test.suites</test.suite.dir>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.33.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.33.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${test.suite.dir}/hTest.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
No comments:
Post a Comment