Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:21 Go to next message
Urtzi Odriozola is currently offline Urtzi OdriozolaFriend
Messages: 27
Registered: March 2010
Junior Member
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 09:14 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
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.*
Re: Give an argument to the swtbot test on run [message #519939 is a reply to message #519902] Wed, 10 March 2010 14:51 Go to previous messageGo to next message
Urtzi Odriozola is currently offline Urtzi OdriozolaFriend
Messages: 27
Registered: March 2010
Junior Member
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 16:55 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
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 18:47 Go to previous message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
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: Thu Apr 18 01:16:43 GMT 2024

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

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

Back to the top