NullPointerException when run testcase

174 views
Skip to first unread message

seven...@gmail.com

unread,
Sep 13, 2013, 3:56:45 AM9/13/13
to robotframework-ec...@googlegroups.com
Dear All

i am researching eclipselibrary, i follow the steps in the wiki. but i get a NullPointerException error.

my testing project

5 files in the lib directory

#my testing application, just a frame with button,  created by SWT
AbsoluteLayout.jar                                
GUIFormExamples.jar           
swt-debug.jar  
      
#robot+eclipse
robotframework-2.7.7.jar
eclipselibrary-0.18-with-dependencies-swt.jar   
# i also add swtbot libs to this directory, but the error still happen


my swtbot.bat is 

setlocal EnableDelayedExpansion
set classpath=./
for %%f in (./lib/*.jar) do (set classpath=!classpath!;./lib/%%f)
java -Xmx512m -cp %classpath% org.robotframework.RobotFramework --debugfile jybot.log --loglevel DEBUG --outputdir results %* 


my testcase just start a swt application and find the button which have the "Add" name 
<table id="testcases" border="1">
<tr>
<th class="name">Test Case</th>
<th>Action</th>
<th colspan="3">Arguments</th>
</tr>
<tr>
<td class="name"><a name="test_Test Button">Test Button add</a></td>
<td>Set EclipseLibrary Log Level</td>
<td>DEBUG</td>
<td></td>
<td></td>
</tr>
<tr>
<td class="name"></td>
<td>Start Application</td>
<td>examples.NewFrame</td>
<td>-debug -consolelog</td>
<td></td>
</tr>
<tr>
<td class="name"></td>
<td>Find Button</td>
<td>Add</td>
<td></td>
<td></td>
</tr>
</table>


when i run my testcaes  , robot give me a error log

+-- START TEST: Test Button add [ ]
------------------------------------------------------------------------------
+--- START KW: EclipseLibrary.Set Eclipse Library Log Level [ DEBUG ]
+--- END KW: EclipseLibrary.Set Eclipse Library Log Level (15)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--- START KW: EclipseLibrary.Find Button [ Add ]
Instanciation of SWTWorkbenchBot
java.lang.NullPointerException
java.lang.RuntimeException: 
at org.robotframework.javalib.library.AnnotationLibrary.retrieveInnerException(AnnotationLibrary.java:93)
at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:75)
at org.lcx.robotframework.eclipse.EclipseLibrary.runKeyword(EclipseLibrary.java:59)
at robot.run$py.main$3(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py:370)
at robot.run$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py)
at robot.utils.application$py._execute$10(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py:88)
at robot.utils.application$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py)
at robot.utils.application$py.execute_cli$5(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py:45)
at robot.utils.application$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py)
at robot.run$py.run_cli$6(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py:399)
at robot.run$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py)
at robot.jarrunner$py._run$3(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py:60)
at robot.jarrunner$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py)
at robot.jarrunner$py.run$2(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py:53)
at robot.jarrunner$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py)
at org.robotframework.RobotFramework.run(RobotFramework.java:62)
at org.robotframework.RobotFramework.main(RobotFramework.java:37)
Caused by: org.lcx.robotframework.eclipse.bridge.SWTBotBridgeException: java.lang.NullPointerException
at org.lcx.robotframework.eclipse.bridge.CauseException.generateException(CauseException.java:37)
at org.lcx.robotframework.eclipse.bridge.SWTBotBridge.callMethod(SWTBotBridge.java:133)
at org.lcx.robotframework.swtbot.eclipse.finder.SWTWorkbenchBot.<init>(SWTWorkbenchBot.java:35)
at org.lcx.robotframework.swtbot.eclipse.finder.SWTWorkbenchBot.getSWTWorkbenchBot(SWTWorkbenchBot.java:23)
at org.lcx.robotframework.eclipse.keyword.swtbot.finder.ButtonFinderKeywords.findButton(ButtonFinderKeywords.java:47)
at org.robotframework.javalib.reflection.KeywordInvoker.invoke(KeywordInvoker.java:49)
at org.robotframework.javalib.beans.annotation.AnnotationKeywordExtractor$1.execute(AnnotationKeywordExtractor.java:55)
at org.robotframework.javalib.library.KeywordFactoryBasedLibrary.runKeyword(KeywordFactoryBasedLibrary.java:37)
at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:73)
... 156 more
Caused by: java.lang.NullPointerException
at org.lcx.robotframework.eclipse.bridge.SWTBotBridge.callMethod(SWTBotBridge.java:114)
... 167 more
+--- END KW: EclipseLibrary.Find Button (29)
------------------------------------------------------------------------------
+-- END TEST: Test Button add (62)

 Did i miss some lib?

my system is 
win8 x64

seven...@gmail.com

unread,
Sep 13, 2013, 11:17:28 AM9/13/13
to robotframework-ec...@googlegroups.com
my SWTBot is version >=2.1
the wiki say SWTBot shuld be 2.0.3   https://code.google.com/p/robotframework-eclipselibrary/wiki/Compatibility

Is this the reason?

Beg for help

seven...@gmail.com

unread,
Sep 14, 2013, 1:55:38 AM9/14/13
to robotframework-ec...@googlegroups.com
i debug it by step and found that i lost the keyword "Start SWTBotBridge"
when I add it, there's another error message



Test CaseActionArguments
Test Button addStart Applicationexamples.NewFrame-debug -consolelog
Set EclipseLibrary Log LevelDEBUG
Sleep5 seconds
Start SWTBotBridge
List All Views Title
Find ButtonAdd



13:41:57.906FAILSwtbotPlugin for RF on error
13:41:57.907DEBUGjava.lang.RuntimeException: at org.robotframework.javalib.library.AnnotationLibrary.retrieveInnerException(AnnotationLibrary.java:93) at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:75) at org.lcx.robotframework.eclipse.EclipseLibrary.runKeyword(EclipseLibrary.java:59) at robot.run$py.main$3(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py:370) at robot.run$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py) at robot.utils.application$py._execute$10(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py:88) at robot.utils.application$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py) at robot.utils.application$py.execute_cli$5(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py:45) at robot.utils.application$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/utils/application.py) at robot.run$py.run_cli$6(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py:399) at robot.run$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/run.py) at robot.jarrunner$py._run$3(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py:60) at robot.jarrunner$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py) at robot.jarrunner$py.run$2(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py:53) at robot.jarrunner$py.call_function(/home/peke/Devel/robotframework/tmp-jar-dir/Lib/robot/jarrunner.py) at org.robotframework.RobotFramework.run(RobotFramework.java:62) at org.robotframework.RobotFramework.main(RobotFramework.java:37) Caused by: org.lcx.robotframework.eclipse.bridge.SWTBotBridgeException: SwtbotPlugin for RF on error at org.lcx.robotframework.eclipse.keyword.launch.StartBridgeKeywords.startSWTBotBridge(StartBridgeKeywords.java:45) at org.robotframework.javalib.reflection.KeywordInvoker.invoke(KeywordInvoker.java:49) at org.robotframework.javalib.beans.annotation.AnnotationKeywordExtractor$1.execute(AnnotationKeywordExtractor.java:55) at org.robotframework.javalib.library.KeywordFactoryBasedLibrary.runKeyword(KeywordFactoryBasedLibrary.java:37) at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:73) ... 144 more Caused by: java.lang.reflect.InvocationTargetException at org.lcx.robotframework.eclipse.keyword.launch.StartBridgeKeywords.startSWTBotBridge(StartBridgeKeywords.java:37) ... 152 more Caused by: java.lang.IllegalStateException: Could not find a display at org.eclipse.swtbot.swt.finder.utils.SWTUtils.display(SWTUtils.java:249) at org.eclipse.swtbot.swt.finder.finders.ControlFinder.<init>(ControlFinder.java:82) at org.eclipse.swtbot.swt.finder.finders.ControlFinder.<init>(ControlFinder.java:72) at org.eclipse.swtbot.swt.finder.SWTBot.<init>(SWTBot.java:114) at org.lcx.robotframework.swtbotplugin.service.SwtbotService.getSWTBot(SwtbotService.java:8) ... 157 more

Laurent Carbonnaux

unread,
Sep 15, 2013, 6:59:18 AM9/15/13
to robotframework-ec...@googlegroups.com
Hello,
I'm not able to reproduce this problem.
I need to investigate further.
Since I'm in progress to develop 0.19 version, it may take some time.
I'll keep you informed

Regards,
Laurent


2013/9/13 <seven...@gmail.com>

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes robotframework-eclipselibrary-users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse robotframework-eclipsel...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .

Laurent Carbonnaux

unread,
Sep 15, 2013, 12:32:19 PM9/15/13
to robotframework-ec...@googlegroups.com
It's seems you application didn't completly launched "Could not find a display".

I'm not able to reproduce this problem since I don't have your application.
Let me take some time to check where this could come from.
I'll keep you inform.
Regards,
laurent.


2013/9/14 <seven...@gmail.com>

--

Laurent Carbonnaux

unread,
Sep 16, 2013, 12:26:01 PM9/16/13
to robotframework-ec...@googlegroups.com, seven...@gmail.com
Hello,

Here is the jar files i'm using in the lib folder:

eclipselibrary-0.18-with-dependencies-swt.jar
org.eclipse.jface_3.5.2.M20100120-0800.jar
robotframework-2.7.7.jar
SWTSample.jar

SWTSample is my application

It works fine with this jars.
You may add the jface jar

Regards,
Laurent.




2013/9/14 <seven...@gmail.com>

--

Laurent Carbonnaux

unread,
Sep 17, 2013, 2:56:27 AM9/17/13
to seven...@gmail.com, robotframework-ec...@googlegroups.com
Hi,
Thank you for your comments.
I will had some of these in the wiki.
You're rigth, the wiki is poor on SWT standalone. The fact is that I don't use it personnaly, so don't have lots of feedback.
Now I havve one!

Regards,
Laurent.


2013/9/17 <seven...@gmail.com>
Thanks for everyone. i have resolve all the problem
i just list the problems for new guys to reference

1、Cannot load 32-bit SWT libraries on 64-bit JVM
just change java 64 to java 32, i don't know someone whether had tested in 64bit system

2、can't find the display
my examples was composed by awt, not swt. this is my mistake

3、can't find a control
people should add "Start SWTBotBridge" keywords after "Start Application*"
when i use "Start Application", it will block testcase , i change to "Start Application In Separate Thread", that's ok


i have upload my example to github 


i think eclipselibrary's wiki lack some examples for SWT standalone


在 2013年9月17日星期二UTC+8上午12时26分01秒,Laurent Carbonnaux写道:


2013/9/14 <seven...@gmail.com>

Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse robotframework-eclipselibrary-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages