Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot test canot load class from application under testing(ClassDefNotFoundError)
SWTBot test canot load class from application under testing [message #1799784] Thu, 13 December 2018 13:15 Go to next message
Alex Gor is currently offline Alex GorFriend
Messages: 151
Registered: November 2014
Location: Russia
Senior Member
Hello

I observed the following obstacle. In unit test I would like to get more information about GUI object for this I have to load class that is located in one bundle. This bundle is part of application under testing. Code Snippet like
 for (SWTBotGefEditPart editorPart : list) {
            Object modelObj = editorPart.part().getModel();
            InventarBrowserDevice model = (InventarBrowserDevice) modelObj;
        }


in line InventarBrowserDevice model = (InventarBrowserDevice) modelObj;
I see the

java.lang.NoClassDefFoundError:
/xxx/yyy/InventarBrowserDevice


java.lang.NoClassDefFoundError: xxx/yyy/InventarBrowserDevice                               
xxx/yyy/InventarBrowserDevice                                                               
java.lang.ClassNotFoundException: xxxx.yyy.InventarBrowserDevice                             
xxx.yyyy..Utils.GraphicUtils GraphicUtils.java 118 graphicalEditorGetElement                  
xxx.yyy.ibrowser.SchaltzettelVorv SchaltzettelVorv.java 116 Schaltzettel           
sun.reflect.NativeMethodAccessorImpl NativeMethodAccessorImpl.java -2 invoke0                                                       
sun.reflect.NativeMethodAccessorImpl NativeMethodAccessorImpl.java 62 invoke                                                        
sun.reflect.DelegatingMethodAccessorImpl DelegatingMethodAccessorImpl.java 43 invoke                                                
java.lang.reflect.Method Method.java 498 invoke                                                                                     
org.junit.runners.model.FrameworkMethod$1 FrameworkMethod.java 44 runReflectiveCall                                                 
org.junit.internal.runners.model.ReflectiveCallable ReflectiveCallable.java 15 run                                                  
org.junit.runners.model.FrameworkMethod FrameworkMethod.java 41 invokeExplosively                                                   
org.junit.internal.runners.statements.InvokeMethod InvokeMethod.java 20 evaluate                                                    
org.junit.runners.BlockJUnit4ClassRunner BlockJUnit4ClassRunner.java 79 runNotIgnored                                               
org.junit.runners.BlockJUnit4ClassRunner BlockJUnit4ClassRunner.java 71 runChild                                                    
org.junit.runners.BlockJUnit4ClassRunner BlockJUnit4ClassRunner.java 49 runChild                                                    
org.junit.runners.ParentRunner$3 ParentRunner.java 193 run                                                                          
org.junit.runners.ParentRunner$1 ParentRunner.java 52 schedule                                                                      
org.junit.runners.ParentRunner ParentRunner.java 191 runChildren                                                                    
org.junit.runners.ParentRunner ParentRunner.java 42 access$000                                                                      
org.junit.runners.ParentRunner$2 ParentRunner.java 184 evaluate                                                                     
org.junit.internal.runners.statements.RunBefores RunBefores.java 28 evaluate                                                        
org.junit.internal.runners.statements.RunAfters RunAfters.java 31 evaluate                                                          
org.junit.runners.ParentRunner ParentRunner.java 236 run                                                                            
org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner SWTBotJunit4ClassRunner.java 54 run                                     
org.junit.runners.Suite Suite.java 128 runChild                                                                                     
xxx.yyy.SSSSuite SSSSuite.java 150 runChild                                    
xxx.yyy.SSSSuite SSSSuite.java 20 runChild                                     
org.junit.runners.ParentRunner$3 ParentRunner.java 193 run                                                                          
org.junit.runners.ParentRunner$1 ParentRunner.java 52 schedule                                                                      
org.junit.runners.ParentRunner ParentRunner.java 191 runChildren                                                                    
org.junit.runners.ParentRunner ParentRunner.java 42 access$000                                                                      
org.junit.runners.ParentRunner$2 ParentRunner.java 184 evaluate                                                                     
org.junit.runners.ParentRunner ParentRunner.java 236 run                                                                            
junit.framework.JUnit4TestAdapter JUnit4TestAdapter.java 39 run                                                                     
org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner EclipseTestRunner.java 350 run                                          
org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner EclipseTestRunner.java 208 run                                          
org.eclipse.swtbot.eclipse.junit.headless.UITestApplication UITestApplication.java 116 runTests                                     
org.eclipse.ui.internal.testing.WorkbenchTestable$1 WorkbenchTestable.java 71 run                                                   
java.lang.Thread Thread.java 748 run                                                                                                

How can I resolve this issue?

[Updated on: Thu, 13 December 2018 13:19]

Report message to a moderator

Re: SWTBot test canot load class from application under testing [message #1799793 is a reply to message #1799784] Thu, 13 December 2018 14:53 Go to previous messageGo to next message
Alex Gor is currently offline Alex GorFriend
Messages: 151
Registered: November 2014
Location: Russia
Senior Member
As first step I added required bumdle to MANIFEST of test plugin. It does not help.
Also I'm able to load required bumndle and load requied Class object rom bundle.

But when try to transform type from Object to required type I catch this exception
 Object modelObj = editorPart.part().getModel(); <--- success
 InventarBrowserDevice model = (InventarBrowserDevice) modelObj; <--- fail

[Updated on: Thu, 13 December 2018 14:59]

Report message to a moderator

Re: SWTBot test canot load class from application under testing [message #1799803 is a reply to message #1799793] Thu, 13 December 2018 18:54 Go to previous message
Alex Gor is currently offline Alex GorFriend
Messages: 151
Registered: November 2014
Location: Russia
Senior Member
Seems to me I found the reason of issue. The bundle that contains required class has empty list of exported package. I've add required one then coersion opertion eas performed with success
Previous Topic:Release planned for Eclipse 2018-12?
Next Topic:2018-12 Issues
Goto Forum:
  


Current Time: Sat Jul 11 06:07:16 GMT 2020

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

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

Back to the top