Running Testng xml from command line

2,141 views
Skip to first unread message

Panna

unread,
Dec 1, 2010, 10:02:58 PM12/1/10
to testng-users
Hi,

I use Test NG with Eclipse.

I use property files to pass parameter values in testng xml.

Most of my xmls look like this:
<property file="param.properties">
<test verbose="2" name="runTestMethod">
<parameter name="paramX" value="${Input.Params.paramX}" />
<classes>
<class name="com.xx.yy.TestClassName">
<methods>
<include name="testMethod"/>
</methods>
</class>
</classes>
</test>

...................................

param.properties looks like this

Input.Params.paramX = 100

...................................................

I am trying to run the testng xml from the command line as following:

java org.testng.TestNG testng.xml

...............................................

My issue is that, when I run the testng.xml from the command line,
properties are not being read.
Framework is passing ${Input.Params.paramX} as a parameter to the test
method.

Has anyone faced such a situation before?

The reason I wanted to run the testng.xml from command line was
because I wanted to see if I could invoke multiple testng xmls to run
multiple test suites parallely.

Tips on running test suites parallelly would be of great help too.

Thanks!

-Panna

Cédric Beust ♔

unread,
Dec 1, 2010, 11:02:36 PM12/1/10
to testng...@googlegroups.com
Hi Panna,

TestNG doesn't do any additional substitution, so when you declare your parameter's value to be "${foo}", you will receive "${foo}".

You seem to be implying that this works from Eclipse, so I suspect that Eclipse might be doing some additional processing of the XML file before actually passing to TestNG. Or maybe you are doing this substitution in your build and you are actually invoking your entire build from Eclipse.

Do any of these theories ring a bell?

As for your second question, yes, TestNG can invoke your suites in parallel, here is how to do it (this was posted in August).

-- 
Cédric




--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


Panna Cherukuri

unread,
Dec 1, 2010, 11:05:38 PM12/1/10
to testng...@googlegroups.com
Hi!
Thanks for quick reply!
I just go to know that someone has incorporated a small piece of code which would convert an data - xml to properties file and then would map the parameters in testng xml to the properties in file.
Sorry about the confusion.

2010/12/2 Cédric Beust ♔ <ced...@beust.com>
Reply all
Reply to author
Forward
0 new messages