|
Re: Give an argument to the swtbot test on run [message #519917 is a reply to message #519902] |
Wed, 10 March 2010 09:14   |
Pascal G Messages: 157 Registered: July 2009 |
Senior Member |
|
|
Urtzi Odriozola wrote:
> Hi!
>
> I've made a generic testcase using SWTBot for then, to be able to change
> some parameters in the test.
>
> So, I wanna give an argument to my swtbot java class when this one is
> executed. This parameter will change the behaviour of the test so, it's
> there any possibilities to do that?
>
> I mean, how can I give a variable to my test class, so, I will able to
> change my test?
>
> Thank you!!
You could probably use system properties when launching your test. When
launching, add this parameter: -Dname.of.property=value ; then, inside
your test case, use this: System.getProperty("name.of.property").
This'll return the value you passed as a string. It's also a good idea
to provide a default value, using the 2 args method instead:
System.getProperty("name.of.property", "defaultValue").
Hope this helps
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02266 seconds