Discussion:
[testng-users] Passing parameters through maven command line
Aswathy Nair
2016-06-11 16:23:31 UTC
Permalink
Hi,

I have defined a parameter in testng.xml. I want to override the value
through maven command line.
<parameter name="environment.code" value="QA"/>

I tried by setting systemPropertyVariable in pom.xml

<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<environment.code>QA</environment.code>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>

But when trying to run through command line maven, value is not getting
overridden.

Can someone pls guide me in acheiving the same.


Thanks,

Aswathy Nair
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Vimal Raj
2016-06-12 04:38:44 UTC
Permalink
Hi Aswathy,

You can change your parameter like this:

<parameter name="environment.code" value="${test.env}" />

and you can remove the *systemPropertyVariable* in your pom.xml.
Then in you command line:

mvn clean test -Dtest.env=QA

This should work.

Thanks
Vimalraj
http://vimalselvam.com
Post by Aswathy Nair
Hi,
I have defined a parameter in testng.xml. I want to override the value
through maven command line.
<parameter name="environment.code" value="QA"/>
I tried by setting systemPropertyVariable in pom.xml
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<environment.code>QA</environment.code>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
But when trying to run through command line maven, value is not getting
overridden.
Can someone pls guide me in acheiving the same.
Thanks,
Aswathy Nair
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Aswathy
2016-06-12 07:10:51 UTC
Permalink
Hi Vimal,

Thanks alot.
I tried the same and it worked for me.

Regards,

Aswathy
Post by Vimal Raj
Hi Aswathy,
<parameter name="environment.code" value="${test.env}" />
and you can remove the *systemPropertyVariable* in your pom.xml.
mvn clean test -Dtest.env=QA
This should work.
Thanks
Vimalraj
http://vimalselvam.com
Post by Aswathy Nair
Hi,
I have defined a parameter in testng.xml. I want to override the value
through maven command line.
<parameter name="environment.code" value="QA"/>
I tried by setting systemPropertyVariable in pom.xml
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<environment.code>QA</environment.code>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
But when trying to run through command line maven, value is not getting
overridden.
Can someone pls guide me in acheiving the same.
Thanks,
Aswathy Nair
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+***@googlegroups.com.
To post to this group, send email to testng-***@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Search results for '[testng-users] Passing parameters through maven command line' (Questions and Answers)
3
replies
Required Java syllabus?
started 2007-07-25 22:08:10 UTC
programming & design
Loading...