Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » java.lang.NoClassDefFoundError when using bot.waitUntil(ICondition)
icon8.gif  java.lang.NoClassDefFoundError when using bot.waitUntil(ICondition) [message #878974] Wed, 30 May 2012 09:42 Go to next message
Yoed Yahav is currently offline Yoed YahavFriend
Messages: 7
Registered: April 2012
Junior Member
I really hope someone can help me with this...

I created a method to wait until a button becomes enabled:

public void isButtonEnabled(final String text) {
        ICondition condition = new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.button(text).isEnabled();
            }
    
            public String getFailureMessage()
            {
                return "Button isn't enabled.";
            }
        };
        bot.waitUntil( condition );
    }


I've imported both:
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.waits.ICondition;


My Manifest file includes:
Manifest-Version: 1.0
Bnd-LastModified: 1338365577629
Build-Jdk: 1.6.0_29
Built-By: yahav
Bundle-ClassPath: .,junit-dep-4.10.jar
Bundle-ManifestVersion: 2
Bundle-Name: Detection Wizard Tests
Bundle-SymbolicName: com.project.detection-wizard-tests;singleton:=true
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile|runtime
Embedded-Artifacts: junit-dep-4.10.jar;g="junit";a="junit-dep";v="4.10"
Export-Package: com.project.detection.wizard.tests;uses:="org.eclipse.s
 wtbot.eclipse.finder,org.eclipse.swtbot.swt.finder.utils,org.eclipse.sw
 tbot.swt.finder.widgets,org.eclipse.swtbot.swt.finder,org.eclipse.swtbo
 t.swt.finder.waits,org.eclipse.swt.widgets,org.eclipse.swtbot.swt.finde
 r.results,org.apache.log4j,org.eclipse.swtbot.swt.finder.exceptions,org
 .hamcrest";version="1.0.0",com.project.detection.wizard.tests.api;uses
 :="org.eclipse.swtbot.eclipse.finder,org.eclipse.swtbot.swt.finder,org.
 eclipse.swtbot.swt.finder.waits,org.eclipse.swtbot.swt.finder.utils,org
 .eclipse.swtbot.swt.finder.widgets,org.eclipse.swt.widgets,org.eclipse.
 swtbot.swt.finder.results,org.apache.log4j,org.eclipse.swtbot.swt.finde
 r.exceptions,org.hamcrest";version="1.0.0"
Import-Package: org.apache.log4j;version="[1.2,2)",org.eclipse.swt.widge
 ts,org.eclipse.swtbot.eclipse.finder,org.eclipse.swtbot.swt.finder,org.
 eclipse.swtbot.swt.finder.exceptions,org.eclipse.swtbot.swt.finder.resu
 lts,org.eclipse.swtbot.swt.finder.utils,org.eclipse.swtbot.swt.finder.w
 aits,org.eclipse.swtbot.swt.finder.widgets,org.hamcrest,org.hamcrest.co
 re
Require-Bundle: org.junit4
Tool: Bnd-1.50.0


Everything looks OK, but I still get the following error:
java.lang.NoClassDefFoundError: org/eclipse/swtbot/swt/finder/waits/ICondition
	at com.hp.slick.detection.wizard.tests.SmartStepsTest.setUp(SmartStepsTest.java:34)
	at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.run(EclipseTestRunner.java:350)
	at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.run(EclipseTestRunner.java:208)
	at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication.runTests(UITestApplication.java:116)
	at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swtbot.swt.finder.waits.ICondition
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)


Can anyone tell me what's wrong?
In my code I use other packages from org.eclipse.swtbot.swt.finder bundle and they work fine (e.g. org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel or org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences)

I have no idea what's going on, and I'm thinking whether to create my own waitUntil method with my own ICondition, but it's a hassle and an ugly workaround.

Ketan is not around as far as I can tell, so I hope someone can assist me with this issue.

Thanks!
Re: java.lang.NoClassDefFoundError when using bot.waitUntil(ICondition) [message #1415975 is a reply to message #878974] Thu, 04 September 2014 04:46 Go to previous message
Shwetali Dhumal is currently offline Shwetali DhumalFriend
Messages: 12
Registered: August 2014
Junior Member
Hi Yoed,

You can try following code:

swtBot.waitUntil(new DefaultCondition() {

@Override
public boolean test() throws Exception {
// TODO Auto-generated method stub
return bot.button(text).isEnabled();
}

@Override
public String getFailureMessage() {
// TODO Auto-generated method stub
return null;
}
});
Previous Topic:wait until some condition
Next Topic:[Maven/Tycho] First editor activation event not delivered?
Goto Forum:
  


Current Time: Tue Mar 19 07:20:10 GMT 2024

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

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

Back to the top