Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » TestSuite execution problem
TestSuite execution problem [message #527202] Wed, 14 April 2010 13:15 Go to next message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
Hi!

I've got a little problem with SWTBot test execution when I wanna execute more than one test cases. For that purpose I use a test runner given by Ketan:

http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/ AllTests.java

The point is that I wanna run each TestCase in a clear enviroment (workbench) for not being in conflict each individual TestCase with the others...

Anyone knows how to run all the TestCases but each one in a clean workbench environment?

Thank in advance.

Regards,
Urtzi
Re: TestSuite execution problem [message #527217 is a reply to message #527202] Wed, 14 April 2010 13:55 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Urtzi Odriozola wrote:
> Hi!
>
> I've got a little problem with SWTBot test execution when I wanna
> execute more than one test cases. For that purpose I use a test runner
> given by Ketan:
>
> http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/ AllTests.java
>
>
> The point is that I wanna run each TestCase in a clear enviroment
> (workbench) for not being in conflict each individual TestCase with the
> others...
>
> Anyone knows how to run all the TestCases but each one in a clean
> workbench environment?
>
> Thank in advance.
>
> Regards,
> Urtzi

It depends on what you mean by clean workbench... for me, a clean
workbench is one with the proper perspective open and the example
project provided by my plugin open. It strongly depends on your test cases.

To achieve a "clean workbench", simply make sure that every test case
has a proper tearDown() (or @After annotated if you are using JUnit4)
that clean up the mess that the test case just made. Let's take an
example: you have a test case that create a new java project using the
new java project wizard. The tearDown() method should close the wizard
if it's still open (because an error happened and the test case did not
properly finish) and delete the created project. This way, you are back
to the same state you were at the beginning of your test.


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

*Because performance matters.*
Re: TestSuite execution problem [message #527229 is a reply to message #527202] Wed, 14 April 2010 14:20 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Just added this to the wiki:
http://wiki.eclipse.org/SWTBot/Custom_Before_And_After_Tasks _for_Tests

– Ketan

On 4/14/10 6:15 AM, Urtzi Odriozola wrote:
> Hi!
>
> I've got a little problem with SWTBot test execution when I wanna
> execute more than one test cases. For that purpose I use a test runner
> given by Ketan:
>
> http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/ AllTests.java
>
>
> The point is that I wanna run each TestCase in a clear enviroment
> (workbench) for not being in conflict each individual TestCase with the
> others...
>
> Anyone knows how to run all the TestCases but each one in a clean
> workbench environment?
>
> Thank in advance.
>
> Regards,
> Urtzi
Re: TestSuite execution problem [message #527420 is a reply to message #527217] Thu, 15 April 2010 08:35 Go to previous messageGo to next message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
Pascal G wrote on Wed, 14 April 2010 09:55
Urtzi Odriozola wrote:
> Hi!
>
> I've got a little problem with SWTBot test execution when I wanna
> execute more than one test cases. For that purpose I use a test runner
> given by Ketan:
>
> http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/ AllTests.java
>
>
> The point is that I wanna run each TestCase in a clear enviroment
> (workbench) for not being in conflict each individual TestCase with the
> others...
>
> Anyone knows how to run all the TestCases but each one in a clean
> workbench environment?
>
> Thank in advance.
>
> Regards,
> Urtzi

It depends on what you mean by clean workbench... for me, a clean
workbench is one with the proper perspective open and the example
project provided by my plugin open. It strongly depends on your test cases.

To achieve a "clean workbench", simply make sure that every test case
has a proper tearDown() (or @After annotated if you are using JUnit4)
that clean up the mess that the test case just made. Let's take an
example: you have a test case that create a new java project using the
new java project wizard. The tearDown() method should close the wizard
if it's still open (because an error happened and the test case did not
properly finish) and delete the created project. This way, you are back
to the same state you were at the beginning of your test.


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

*Because performance matters.*


Ok, I understand. And yes, definitely you catch out my idea of "clean workbench".

I thought that there was a simpler way of clean up the mess of my TestCases. I think that doing like you said, you do much effort because you have to write a test 2 times (the second one backwards...).

For example, when I run my tests individually, each test starts in a fresh workbench even if they messed the configuration before. But if I run all my test like I explained above, this not happens.

Thank you for your contribution!
Re: TestSuite execution problem [message #527499 is a reply to message #527420] Thu, 15 April 2010 13:13 Go to previous message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Urtzi Odriozola wrote:

> I thought that there was a simpler way of clean up the mess of my
> TestCases. I think that doing like you said, you do much effort because
> you have to write a test 2 times (the second one backwards...).
>

That's unit testing for you :P It's not a SWTBot-only problem: every
test cases that modify some kind of persistent state (the UI, a
database, the filesystem) must clean it up afterwards.

It would definitely be better with a simpler way, but it would be kinda
hard to guess what to do to clean up the workbench. Each test case is
unique, so each clean up is unique

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

*Because performance matters.*
Previous Topic:Problem with CommandFinder...
Next Topic:New SWTBot builds
Goto Forum:
  


Current Time: Tue Sep 23 18:23:48 GMT 2014

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

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