ANT - TestNG Task

38 views
Skip to first unread message

Ashish S

unread,
Oct 21, 2021, 11:53:29 AM10/21/21
to testng-users
Hi,

I am trying to make a parameterized Target for TestNG in ANT with aim to have desired "Attribute" passed from command line itself.

Sample from build.xml
<target name="test" depends="compile">
<echo message="${suiteXML}"/>
<echo message="${testGRP}"/>
<!-- TestNG Tag -->
<testng classpath="${test.classpath};${build.dir}" groups="${testGRP}">
<xmlfileset dir="${basedir}" includes="${suiteXML}" />
</testng>
</target>

Sample Commands
ant test -DsuiteXML=testng.xml
ant test -DsuiteXML=testng.xml, ABC.xml
ant test -DsuiteXML=testng.xml -DtestGRP=smoke

Please share if you have any sample code(for build xml file) available to consider only those attributes in TestNG Task which are passed as parameter/property from command line. Else those attributes should not be considered.

Something around how we can dynamically create TestNG Ant task.

Thanks,
Ashish

Ashish S

unread,
Oct 26, 2021, 2:42:28 AM10/26/21
to testng-users

Please share if any suggestion to achieve the same.

Thanks,
Ashish

⇜Krishnan Mahadevan⇝

unread,
Oct 26, 2021, 2:56:16 AM10/26/21
to testng-users
Ashish,
Perhaps because there are not many Ant users, is why you aren't seeing a lot of traction on your question.
Would it be possible for you please elaborate what is the use case that you are trying to solve and what do you intend to achieve with that.
Please feel free to add as much context as possible so that someone in the forum can help you with an answer.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/ea760220-165c-41af-be00-b464fa89784bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages