Not found Junit Test Case [message #14168] |
Thu, 15 January 2009 11:17  |
Eclipse User |
|
|
|
Hello,
I am trying to test a eclipse plugin with SWTbot, but I having problems.
1)I added the plugins necessary for SWTbot.
2)I created a plug-in project in Eclipse and added my Junit Test case.
3)I configured my classpath and run this class like junit3 (Test runner)
4) Finally, I run a product like org.eclipse.sdk.ide
The result is:
Class not found eee.FooTest
java.lang.ClassNotFoundException: eee.FooTest
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:313)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1274)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r$BundleClassLoader.findClass(RemotePluginTestRunner.java:38 )
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadC lass(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadC lasses(RemoteTestRunner.java:425)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:445)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
net.sf.swtbot.eclipse.ui.TestApplication.runTests(TestApplic ation.java:122)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Unknown Source)
Can someone help me??
Thanks and regards.
|
|
|
Re: Not found Junit Test Case [message #14188 is a reply to message #14168] |
Thu, 15 January 2009 11:53   |
Eclipse User |
|
|
|
You may not be exporting the package from your plugin.
Also use JUnit 4 is not supported for execution from within Ant. I'd
recommend using JUnit 3. More on this here:
http://wiki.eclipse.org/SWTBot/UsersGuide
-- Ketan
On 15/1/09 16:47, Luis Miguel wrote:
> Hello,
>
> I am trying to test a eclipse plugin with SWTbot, but I having problems.
>
> 1)I added the plugins necessary for SWTbot.
> 2)I created a plug-in project in Eclipse and added my Junit Test case.
> 3)I configured my classpath and run this class like junit3 (Test runner)
> 4) Finally, I run a product like org.eclipse.sdk.ide
>
> The result is:
> Class not found eee.FooTest
> java.lang.ClassNotFoundException: eee.FooTest
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.loadCl ass(BundleLoader.java:313)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.loadClas s(BundleHost.java:227)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.load Class(AbstractBundle.java:1274)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r$BundleClassLoader.findClass(RemotePluginTestRunner.java:38 )
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadC lass(RemoteTestRunner.java:683)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadC lasses(RemoteTestRunner.java:425)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:445)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
>
> at
> net.sf.swtbot.eclipse.ui.TestApplication.runTests(TestApplic ation.java:122)
> at
> org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
>
> at java.lang.Thread.run(Unknown Source)
>
> Can someone help me??
>
> Thanks and regards.
>
|
|
|
|
|
Re: Not found Junit Test Case [message #14272 is a reply to message #14256] |
Thu, 15 January 2009 15:19   |
Eclipse User |
|
|
|
Hi,
If you look the part of tutorial: "Executing SWTBot Tests for Eclipse
Plugins", when we select the application that I want to test,there are
three parts that we must configure: Workspace data, Program to run and
Java Runtime Environment.
The first (Workspace data), we select
"${workspace_loc}/../junit-workspace" or we select a new workspace? Is
this important?
Thanks and regards
Luis Miguel
|
|
|
Re: Not found Junit Test Case [message #14288 is a reply to message #14272] |
Thu, 15 January 2009 16:05   |
Eclipse User |
|
|
|
It does not matter where your workspace is located.
In order that tests are repeatable, and reproducible every time, it is
generally the case that you clear your workspace.
If you need some projects or some workspace settings that you need in
your workspace, you may import them as part of your test setup.
-- Ketan
On 15/1/09 20:49, Luis Miguel wrote:
> Hi,
> If you look the part of tutorial: "Executing SWTBot Tests for Eclipse
> Plugins", when we select the application that I want to test,there are
> three parts that we must configure: Workspace data, Program to run and
> Java Runtime Environment. The first (Workspace data), we select
> "${workspace_loc}/../junit-workspace" or we select a new workspace? Is
> this important?
>
> Thanks and regards
>
> Luis Miguel
>
|
|
|
Re: Not found Junit Test Case [message #14305 is a reply to message #14288] |
Thu, 15 January 2009 17:31   |
Eclipse User |
|
|
|
Hello Ketan,
Thanks for yours answers.
Now, I can to run my Test Case but some actions do not work. For example,
in my test Case:
public class FooTest extends SWTBotEclipseTestCase {
// stuff you can do with Eclipse
public void testDoSomethingInterestingWithEclipse() throws Exception {
SWTBotView vista=bot.view("Package Explorer");
vista.close();
SWTBotMenu menuF=bot.menu("Window");
menuF.click();
}
}
The action: SWTBotView vista=bot.view("Package Explorer");
vista.close();
works, but the next action does not work. Console from Eclipse prints:
log4j:WARN No appenders could be found for logger
(net.sf.swtbot.matcher.AbstractMatcher).
log4j:WARN Please initialize the log4j system properly.
Any suggestions?
Thanks again.
Luis Miguel
|
|
|
|
Re: Not found Junit Test Case [message #15203 is a reply to message #15170] |
Mon, 19 January 2009 08:31   |
Eclipse User |
|
|
|
Hello Ketan,
Thanks for yours answers one more time. Now, I can to run my Test Case
without WARNINGS about log4j but I have problems with
AbstractMatcher.java. If I run this code:
public class FooTest extends SWTBotEclipseTestCase {
// stuff you can do with Eclipse
public void testDoSomethingInterestingWithEclipse() throws Exception {
bot.view("Package Explorer").close();
bot.menu("File").menu("New").click();
}
}
The action " bot.menu("File").menu("New").click()" does not work. Console
from Eclipse prints:
16 ene 2009 13:40:53.140 - main - TRACE - AbstractMatcher -
(AbstractMatcher.java:63) - +---Widget: MenuItem{Format Eleme&nt}
16 ene 2009 13:40:53.140 - main - TRACE - AbstractMatcher -
(AbstractMatcher.java:51) - did not match MenuItem A&dd Import, using
matcher: with mnemonic 'File'
.......................
If I capture this action between a "try..catch" structure throws a
WidgetNotFoundException.
Thanks and regards.
Luis Miguel
|
|
|
Re: Not found Junit Test Case [message #15268 is a reply to message #15203] |
Mon, 19 January 2009 09:06   |
Eclipse User |
|
|
|
On 19/1/09 14:01, Luis Miguel wrote:
> Hello Ketan,
>
> Thanks for yours answers one more time. Now, I can to run my Test Case
> without WARNINGS about log4j but I have problems with
> AbstractMatcher.java. If I run this code:
>
> public class FooTest extends SWTBotEclipseTestCase {
> // stuff you can do with Eclipse
> public void testDoSomethingInterestingWithEclipse() throws Exception {
> bot.view("Package Explorer").close(); bot.menu("File").menu("New").click();
> }
> }
>
> The action " bot.menu("File").menu("New").click()" does not work.
You're probably getting an exception on the "Package Explorer" closing.
bot.view("Welcome").close();
Also you'd perhaps want to do:
bot.menu("File").menu("New").menu("Class").click();
"New" happens to be a container for menu items, and clicking on it does
nothing. There's a screenshots folder in your plugin that may have more
information on why the test actually failed.
-- Ketan
|
|
|
Re: Not found Junit Test Case [message #15334 is a reply to message #15268] |
Mon, 19 January 2009 10:57   |
Eclipse User |
|
|
|
Hello Ketan,
I write below your last post for to explain my problem:
- "You're probably getting an exception on the "Package Explorer" closing.
bot.view("Welcome").close();"
This does not happen because I have tried without this line and continuing
the same problem.
- "Also you'd perhaps want to do:
bot.menu("File").menu("New").menu("Class").click();
"New" happens to be a container for menu items, and clicking on it does
nothing.
It is true, but the problem is about the first menu: "File".
If I try with the action: "bot.menu("Window").menu("New
Window").click();", the problem is with "Window" (first menu).
With the action "bot.menu("File").menu("New").menu("Class").click();": My
problem does not change. Console prints:
AbstractMatcher - (AbstractMatcher.java:51) - did not match MenuItem
Togg&le Comment, using matcher: with mnemonic 'File'
AbstractMatcher - (AbstractMatcher.java:63) - +---Widget: MenuItem{Togg&le
Comment}
AbstractMatcher - (AbstractMatcher.java:51) - did not match MenuItem Add
&Block Comment, using matcher: with mnemonic 'File'
AbstractMatcher - (AbstractMatcher.java:63) - +---Widget: MenuItem{Add
&Block Comment}
....
....
If you want to, I could send the entire log.
Thanks and regards
Luis Miguel
|
|
|
Re: Not found Junit Test Case [message #15367 is a reply to message #15334] |
Mon, 19 January 2009 12:01   |
Eclipse User |
|
|
|
Please file a bug with a reproducible test case that I can execute on my
machine.
I'll need to know the version number of eclipse and SWTBot that you're
using.
-- Ketan
On 19/1/09 16:27, Luis Miguel wrote:
> If you want to, I could send the entire log.
>
> Thanks and regards
>
> Luis Miguel
>
|
|
|
Re: Not found Junit Test Case [message #15400 is a reply to message #15367] |
Mon, 19 January 2009 12:30   |
Eclipse User |
|
|
|
Hi,
Eclipse version: 3.4.1
SWTBot version: 2.0
If you put the next code in your junit test case, you will have my problem:
import net.sf.swtbot.eclipse.finder.SWTBotEclipseTestCase;
public class FooTest extends SWTBotEclipseTestCase {
public void testDoSomethingInterestingWithEclipse() throws Exception {
bot.view("Package Explorer").close(); //This works.
bot.menu("Window").menu("New Window").click();
}
Regards.
Luis Miguel
|
|
|
|
Re: Not found Junit Test Case [message #15561 is a reply to message #15400] |
Tue, 20 January 2009 03:21   |
Eclipse User |
|
|
|
On 19/1/09 18:00, Luis Miguel wrote:
> Hi,
> Eclipse version: 3.4.1
> SWTBot version: 2.0
2.0 is quite a broad version I'll need the full version number of the
form "2.0.0.SOME_NUMBER"
-- Ketan
|
|
|
|
|
Re: Not found Junit Test Case [message #15683 is a reply to message #15623] |
Tue, 20 January 2009 11:50   |
Eclipse User |
|
|
|
Hi,
I'm desperate.The same problem again! Perhaps I have wrong the plugin
configuration. I have org.eclipse.swtbot.eclipse-2.0.0.75-dev.zip with two
folders ("features" and "plugins"). Before you start Eclipse with SWTBot,
I add the content of "features" to "features" of my Eclipse. The same for
the "plugins" folder.
In addition, I add the contents of "features" and "plugins" from
net.sf.swtbot.eclipse-2.0.0.1164-dev to "features" and "plugins" of my
Eclipse. I do this because it says the tutorial from
http://swtbot.sourceforge.net/users-guide.html.
Okay this configuration?
Thanks!!
Luis Miguel
|
|
|
Re: Not found Junit Test Case [message #15709 is a reply to message #15683] |
Tue, 20 January 2009 13:04   |
Eclipse User |
|
|
|
Luis,
Can you try taking a fresh eclipse install, and extract the zip file
into the eclipse's 'dropins' folder, the update site is broken for
version 2.0.0.75, and I'll be fixing it later.
Type in the following test:
public class FooTest extends SWTBotTestCase {
public void testDoSomethingInterestingWithEclipse() throws Exception {
bot.view("Welcome").close();
bot.menu("File").menu("New").menu("Class").click();
}
}
and you should get a green bar.
-- Ketan
On 20/1/09 17:20, Luis Miguel wrote:
> Hi,
>
> I'm desperate.The same problem again! Perhaps I have wrong the plugin
> configuration. I have org.eclipse.swtbot.eclipse-2.0.0.75-dev.zip with
> two folders ("features" and "plugins"). Before you start Eclipse with
> SWTBot, I add the content of "features" to "features" of my Eclipse. The
> same for the "plugins" folder.
> In addition, I add the contents of "features" and "plugins" from
> net.sf.swtbot.eclipse-2.0.0.1164-dev to "features" and "plugins" of my
> Eclipse. I do this because it says the tutorial from
> http://swtbot.sourceforge.net/users-guide.html.
>
> Okay this configuration?
>
> Thanks!!
>
> Luis Miguel
>
|
|
|
Re: Not found Junit Test Case [message #16401 is a reply to message #15709] |
Tue, 20 January 2009 17:04   |
Eclipse User |
|
|
|
Hi,
If I extend from SWTBotTestCase class, I need import
net.sf.swtbot.SWTBotTestCase and the last version is
net.sf.swtbot-2.0.0.1164-dev.
In addition, if I extend from SWTBotTestCase, the action bot.view
("Welcome").close() does not work.
|
|
|
Re: Not found Junit Test Case [message #16408 is a reply to message #16401] |
Tue, 20 January 2009 17:09  |
Eclipse User |
|
|
|
Oops, I'd meant SWTBotEclipseTestCase.
If things do not work, please file a bug at bugs.eclipse.org and attach
the complete log file (compress it please)
-- Ketan
On 20/1/09 22:34, Luis Miguel wrote:
> Hi,
> If I extend from SWTBotTestCase class, I need import
> net.sf.swtbot.SWTBotTestCase and the last version is
> net.sf.swtbot-2.0.0.1164-dev. In addition, if I extend from
> SWTBotTestCase, the action bot.view ("Welcome").close() does not work.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04005 seconds