Passing parameters to TestNG in Ant

7 views
Skip to first unread message

Bela Ban

unread,
Apr 4, 2008, 7:58:50 AM4/4/08
to testng...@googlegroups.com
I'm missing the option to pass parameters to a TestNG Ant task, e.g.

<testng classpathref="jg.classpath"
             parameters="channel.conf=udp.xml,mux.on=false"
/>

The 'parameters' element could also be nested XML...

Is this by design or is it an oversight ?

Cédric Beust ♔

unread,
Apr 4, 2008, 11:39:46 AM4/4/08
to testng...@googlegroups.com
You can already define properties (java -Dfoo=bar) and these will be used as @Parameters if no corresponding parameters were found in testng.xml.

It seems to me this is similar to what you're asking for(?).

--
Cédric

Bela Ban

unread,
Apr 7, 2008, 3:14:37 AM4/7/08
to testng...@googlegroups.com
Ah, didn't know that !

But this is not going to help as I'll invoke TestNG multiple times within the same JVM, e.g.:

<target name="udp-tests>
    ...

    <testng classpathref="jg.classpath"
             parameters="channel.conf=udp.xml,mux.on=false"
   
/>
</target>

<target name="tcp-tests>
    ...
    <testng classpathref="jg.classpath"
             parameters="channel.conf=tcp.xml,mux.on=false"
   
/>
</target>

<target name="udp-mux-tests>
    ...
    <testng classpathref="jg.classpath"
             parameters="channel.conf=udp.xml,mux.on=true"
   
/>
</target>

<target name="tcp-mux-tests>
    ...
    <testng classpathref="jg.classpath"
             parameters="channel.conf=tcp.xml,mux.on=true"
   
/>
</target>



So I want to be able to pass different parameters to different targets. This is not possible with a system property


Alexandru Popescu ☀

unread,
Apr 9, 2008, 1:03:48 PM4/9/08
to testng...@googlegroups.com

I think it is possible as the testng class supports itself specifying
sysproperties so each of the above targets will be able to define
their own set of values.

./alex
--
.w( the_mindstorm )p.
Alexandru Popescu
TestNG co-founder
EclipseTestNG Creator

Reply all
Reply to author
Forward
0 new messages