Skip to main content



      Home
Home » Eclipse Projects » SWTBot » Give an argument to the swtbot test on run
Give an argument to the swtbot test on run [message #519902] Wed, 10 March 2010 08:21 Go to next message
Eclipse UserFriend
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!!
Re: Give an argument to the swtbot test on run [message #519917 is a reply to message #519902] Wed, 10 March 2010 04:14 Go to previous messageGo to next message
Eclipse UserFriend
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.*
Re: Give an argument to the swtbot test on run [message #519939 is a reply to message #519902] Wed, 10 March 2010 09:51 Go to previous messageGo to next message
Eclipse UserFriend
Wooowww!!

That's a quick and great answer!! That works perfectly to me!!

Thank you very much!!!

Regards,
Re: Give an argument to the swtbot test on run [message #519978 is a reply to message #519902] Wed, 10 March 2010 11:55 Go to previous messageGo to next message
Eclipse UserFriend
Something like this:
http://kentbeck.github.com/junit/javadoc/latest/org/junit/ru nners/Parameterized.html
?

-- Ketan

On 3/10/10 5:21 AM, 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!!
Re: Give an argument to the swtbot test on run [message #520014 is a reply to message #519978] Wed, 10 March 2010 13:47 Go to previous message
Eclipse UserFriend
Ketan Padegaonkar wrote:
> Something like this:
> http://kentbeck.github.com/junit/javadoc/latest/org/junit/ru nners/Parameterized.html
> ?

Didn't know that this existed! Seems quite handy! It also look more
appropriated then my solution.

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Previous Topic:JUnit as dependency for SWTBot features?
Next Topic:Ant not getting environment on MacOSX when running within Eclipse
Goto Forum:
  


Current Time: Fri Jul 11 22:40:40 EDT 2025

Powered by FUDForum. Page generated in 0.03979 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top