Maven Surefire plugin is not picking the parameters. When I run the Regression Suite xml in eclipse it works fine. But the same xml does not work when I run as Maven test.For some reason it is not picking up the parameters. I have been struggling with this for a while. Please help. Thanks
RegressionSuite.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name= "RegressionTests">
<suite-files>
<!-- suite-file path="CreateUsers.xml"-->
<suite-file path="ReportFormatting.xml" />
<suite-file path="SectionsFormating.xml" />
<suite-file path="ColumnFormatting.xml" />
<suite-file path="AdvancedFunctions.xml" />
<suite-file path="AnalysisStyle.xml" />
<suite-file path="CalculatedFields.xml" />
<suite-file path="Aggregration.xml" />
<!-- suite-file path="Admin.xml"/-->
</suite-files>
</suite>
Here is my POM
plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>8</source>
<target>8</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_91\bin\javac.exe</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<executions>
<execution>
<id>test</id>
<phase>integration-test</phase>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
src\test\resources\RegressionTests.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Here is the error message
enParameter 'userName' is required by @Test on method Date_Aggregration but has not been marked @Optional or defined
at org.testng.internal.Parameters.createParams(Parameters.java:290)
at org.testng.internal.Parameters.createParametersForMethod(Parameters.java:359)
at org.testng.internal.Parameters.createParameters(Parameters.java:620)
at org.testng.internal.Parameters.handleParameters(Parameters.java:769)
at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:49)ter code here
Here is my ReportFormatting.xml
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Regression - Report Formatting" verbose="1" configfailurepolicy="continue">
<listeners>
<listener class-name="y.bi.extentReportListener.ExtentReportListener"/>
</listeners>
<parameter name="axisA" value="1" />
<parameter name="axisB" value="2" />
<parameter name="viewName" value="Ski Team"></parameter>
<!-- REPORT FIELDS -->
<!-- this is your report data set -->
<parameter name="rf1" value="Athlete Country" />
<parameter name="rf2" value="Agency Country" />
<parameter name="rf3" value="Invoiced Amount" />
<parameter name="rf4" value="Athlete Counter" />
<parameter name="rf5" value="Invoice Estimate" />
<!-- Data Section font type and size fields -->
<parameter name="fontType" value="Courier"></parameter>
<parameter name="fontSize" value="16"></parameter>
<!-- Column and Row Header font type and size -->
<parameter name="headerFontType" value="Helvetica"></parameter>
<parameter name="headerFontSize" value="18"></parameter>
<!-- Border Width -->
<parameter name="borderWidth" value="Thick"></parameter>
<!-- Title and Description -->
<parameter name="displayTitleFontType" value="Roboto"></parameter>
<parameter name="displayTitleFontSize" value="20"></parameter>
<parameter name="displayDescFontType" value="Geneva"></parameter>
<parameter name="displayDescFontSize" value="19"></parameter>
<!-- yellowfin login credentials -->
<parameter name="URL" value="http://10.10.5.77:8082/" />
<parameter name="userName" value="admin" />
<parameter name="passsword" value="test" />
>
<test name="ReportFormatting">
<classes>
<class name="y.bi.test.ReportFormatting">
<methods>
<include name="ValidateDataSection"></include>
<include name="ValidateColumnandRowHeadingsandBorder"></include>
<include name="ValidateTitleandDescription"></include>
<include name="ValidateHeaderFooterandTableSort"></include>
<!-- <include name=""></include> -->
</methods>
</class>
</classes>
</test>
</suite>