Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Manage SWTBot and JUnit tests
Manage SWTBot and JUnit tests [message #514680] Tue, 16 February 2010 05:30 Go to next message
David CHAUTARD is currently offline David CHAUTARD
Messages: 102
Registered: July 2009
Senior Member
Hello,

I generate plugins with a XSD (GenModel), and I get tree plugins :
- myplugin
- myplugin.edit
- myplugin.editor.

Then I generate the Test Code plugin, which contains JUnit tests. But I don't know how to manage these generated tests with my SWTBot tests, in the same project, in order to launch only one test plugin.

Thanks for your help,
David.
Re: Manage SWTBot and JUnit tests [message #515008 is a reply to message #514680] Wed, 17 February 2010 08:44 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARD
Messages: 102
Registered: July 2009
Senior Member
Hello,

I create a new package, in my test plugin, wich contains SWTBot tests. And when I run tests on my plugin with SWTBot, I have some problem "WidgetNotFoundException". While when I run my SWTBot TestSuite I have no problem.

I don't know how to structure my plugin test for SWTBot tests and JUnit tests, and how to launch them. I think used Ant, but I don't know if it is the solution.

David
Re: Manage SWTBot and JUnit tests [message #515106 is a reply to message #515008] Wed, 17 February 2010 12:48 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 720
Registered: July 2009
Location: Grenoble, France
Senior Member
Hello,

I don't think that what you are trying to do is possible. Indeed your JUnit test probably require to run on a UIThread, whereas SWTBot test cannot be run from a UIThread, so that they probably cannot be launched by the same application.
Have you correctly set the @RunWith annotation on your SWTBot test class?

David CHAUTARD a écrit :
> Hello,
>
> I create a new package, in my test plugin, wich contains SWTBot tests.
> And when I run tests on my plugin with SWTBot, I have some problem
> "WidgetNotFoundException". While when I run my SWTBot TestSuite I have
> no problem.
>
> I don't know how to structure my plugin test for SWTBot tests and JUnit
> tests, and how to launch them. I think used Ant, but I don't know if it
> is the solution.
>
> David


--

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: Manage SWTBot and JUnit tests [message #515223 is a reply to message #515106] Thu, 18 February 2010 04:04 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARD
Messages: 102
Registered: July 2009
Senior Member
Thanks Mickael for your answer.

I add the @RunWith annotation in my SWTBot class, with @RunWith(SWTBotJunit4ClassRunner.class) and annotation for methods. But I always have the problem of "WidgetNotFoundException". What is the launcher to use, JUnit or SWTBot?
Then I would like to use a TestSuite to launch SWTBot tests, to have a run order for my tests. I use
@RunWith(Suite.class)
@SuiteClasses({MyTest.class})

but it launches MyTest.class test twice. Do you have an idea for my problem?

Thanks,
David.
Re: Manage SWTBot and JUnit tests [message #515349 is a reply to message #515223] Thu, 18 February 2010 08:58 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 720
Registered: July 2009
Location: Grenoble, France
Senior Member
> I add the @RunWith annotation in my SWTBot class, with
> @RunWith(SWTBotJunit4ClassRunner.class) and annotation for methods. But
> I always have the problem of "WidgetNotFoundException".

Does your test find the widget when running it manually from Eclipse?

> What is the launcher to use, JUnit or SWTBot?

I think SWTBot launcher is able to start "standard" JUnit tests too, but the contrary probably fails. Then I suggest you try with SWTBot JUnit launcher.

> Do you have an idea for my problem?

Sorry I don't have any idea. We previewed some time dedicated to writing a SWTBot test campaign soon. If we find any piece of answer, we will for sure tell you!

Meanwhile, good luck!

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Previous Topic:ContextMenu focusing problems
Next Topic:Ant: NoClassDEfFoundError while accessing another plugin
Goto Forum:
  


Current Time: Thu Apr 17 05:38:58 EDT 2014

Powered by FUDForum. Page generated in 0.02149 seconds