Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » StartupRecorder.openRecorder fails with NPE(StartupRecorder.openRecorder fails with NPE)
StartupRecorder.openRecorder fails with NPE [message #1766104] Thu, 15 June 2017 17:49 Go to next message
Keith Willenson is currently offline Keith WillensonFriend
Messages: 21
Registered: July 2009
Junior Member
I am trying to record my application so I can test it.
I am using
Version: Neon.3 Release (4.6.3) Build id: 20170314-1500
jdk1.8.0_101

I added
org.eclipse.swtbot.generator.ui.StartupRecorder.openRecorder("small Sample");


and it fails with

Exception in thread "main" java.lang.NullPointerException
at org.eclipse.swtbot.generator.ui.GeneratorExtensionPointManager.loadGenerators(GeneratorExtensionPointManager.java:32)
at org.eclipse.swtbot.generator.ui.StartupRecorder$StartRecorderRunnable.run(StartupRecorder.java:57)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4821)
at org.eclipse.swtbot.generator.ui.StartupRecorder.openRecorder(StartupRecorder.java:122)
at com.small.Sample.main(Sample.java:66)

I have a very small example (error messages are from example) that replicates this. I am sure I am doing something simple incorrectly.

my .classpath is
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swt.win32.win32.x86_3.105.3.v20170228-0512.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swt_3.105.3.v20170228-0512.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swtbot.generator.jdt_2.5.0.201609021837.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swtbot.generator.rules.workbench_2.5.0.201609021837.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swtbot.generator.ui_2.5.0.201609021837.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swtbot.generator_2.5.0.201609021837.jar" sourcepath="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.swtbot.generator.source_2.5.0.201609021837.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.ui.win32_3.3.0.v20160505-1310.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.ui.workbench_3.108.3.v20170216-1539.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.core.runtime_3.12.0.v20160606-1342.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.core.contenttype.source_3.5.100.v20160418-1621.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.core.resources.win32.x86_3.5.100.v20140124-1940.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.core.resources_3.11.1.v20161107-2032.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.equinox.common_3.8.0.v20160509-1230.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.jface_3.12.2.v20170113-2113.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.osgi_3.11.3.v20170209-1843.jar"/>
	<classpathentry kind="lib" path="C:/eclipse-java-neon-2-win32/eclipse/plugins/org.eclipse.equinox.registry_3.6.100.v20160223-2218.jar"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
Re: StartupRecorder.openRecorder fails with NPE [message #1766154 is a reply to message #1766104] Fri, 16 June 2017 14:15 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
Hi Keith,

I can reproduce your problem.

The error occurs because the platform's RegistryProviderFactory has not been initialized.

Even though you are including some of the necessary platform plug-ins, the platform itself is not being initialized. Is your application an Eclipse application?

If it is not, then I believe you cannot use the SWTBot Generator to test your application as the generator requires the Eclipse platform.

Patrick
Re: StartupRecorder.openRecorder fails with NPE [message #1766157 is a reply to message #1766154] Fri, 16 June 2017 15:04 Go to previous messageGo to next message
Keith Willenson is currently offline Keith WillensonFriend
Messages: 21
Registered: July 2009
Junior Member
Yes, it is an eclipse application What am I missing?
Re: StartupRecorder.openRecorder fails with NPE [message #1766158 is a reply to message #1766157] Fri, 16 June 2017 15:35 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
If you are running from Eclipse, make sure that your Run Configuration's Main tab uses Program to Run: org.eclipse.platform.ide (product) or org.eclipse.ui.ide.workbench (application) or if your application is an RCP, its application id.

If you are running with Maven, make sure your pom.xml has the necessary elements, this might help: https://wiki.eclipse.org/SWTBot/Automate_test_execution#On_a_plugin_project_project_with_Maven_and_Tycho
Re: StartupRecorder.openRecorder fails with NPE [message #1766387 is a reply to message #1766158] Tue, 20 June 2017 20:57 Go to previous messageGo to next message
Keith Willenson is currently offline Keith WillensonFriend
Messages: 21
Registered: July 2009
Junior Member
I am confused. I can't get either of those to work as a Java (or Eclipse) Application (so maybe that's wrong).
I thought the whole point of
org.eclipse.swtbot.generator.ui.StartupRecorder.openRecorder("small Sample");

was to have a button or menu item that you could press in a normal Java application that would start the recorder.

I have a Java Application that I am trying to record.
I am trying (and failing) to follow the instructions on https://wiki.eclipse.org/SWTBot/Generator
Re: StartupRecorder.openRecorder fails with NPE [message #1766917 is a reply to message #1766387] Wed, 28 June 2017 17:21 Go to previous message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
Hi Keith,

The parameter to pass in StartupRecorder.openRecorder(String) is the dialog ID of the SWTBot Recorder dialog to open, e.g. one of:

"org.eclipse.swtbot.generator.dialog.basic" (default)
"org.eclipse.swtbot.generator.dialog.jdt"

Or pass null or empty string to open the default (that can also be set in "org.eclipse.swtbot.generator.dialog" system property).

I'll update the wiki.

Patrick
Previous Topic:SWTBOT Spy View
Next Topic:More wait conditions
Goto Forum:
  


Current Time: Thu Apr 25 06:11:37 GMT 2024

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

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

Back to the top