I use Ant to run TestNG like this:
[b]Format#1[/b]
[i]<testng >
...
<jvmarg>-Dprop1=value1</jvmarg>
<jvmarg>-Dprop2=value2</jvmarg>
...
</testng>[/i]
This works.
But if I changed above to
[b]Format#2:[/b]
[i]<testng >
...
<jvmarg>-Dprop1=value1 -Dprop2=value2</jvmarg>
....
</testng>[/i]
It doesn't seems to work now; in particular -Dprop2=value2 is not taking effect.
So my question is why?. Since java.exe is launched under the hood in commandline fashion
java.exe -Dprop1=value1 -Dprop2=value2,
my first guess is that it probably doesn't matter if the -Dprop1=value1 -Dprop2=value2 are entered as one single <jvmarg> or two <jvmarg>.
Obviously, from above it does seems to matter.
Am I missing something?.
I needed format#2 as I dynamically scan an xml configuration file we used here and
concenated all -Dprops=values together and attempt to pass them in as a
single <jvmarg>....<./jvmarg> to testng
Any insight or help appreciated.
-BK-
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=48774&messageID=98317#98317
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
It is Ant default behavior. You can read more in the Manual: using.html#arg
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
> --
Alex's suggestion works !
I can see the single "-Dprop1=value1 -Dprop2=value2" split
into 2 separate arguments "-Dprop1=value1" and "-Dprop2=value2"
-BK-
>
> ./alex
> --
> .w( the_mindstorm )p.
> TestNG co-founder
http://forums.opensymphony.com/thread.jspa?threadID=48774&messageID=98324#98324
2. a line argument is split by spaces. This is not always what you
want, as the split takes place after property expansion. if value1 or
value2 have spaces in, you are hosed. This can be an insidious source
of bugs if a value is a path, as it may work on some users machines
and not on others, depending on their filesystem.
3. most tasks let you set jvm properties with the <sysproperty> element.
-S.