Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Programmatically opening Junit test case creation wizard
Programmatically opening Junit test case creation wizard [message #325306] Thu, 14 February 2008 00:33 Go to next message
Eclipse UserFriend
Originally posted by: abinashsahu.hsbc.co.in

Hi,

I want to open the <b>"unit test case creation wizard"</b> programmatically to create a test case in eclipse but when i try with the following code it gives me Null pointer exception.

Code:

NewTestCaseCreationWizard wizard=new NewTestCaseCreationWizard();
wizard.init(workbench,new StructuredSelection());
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();

Exception :

java.lang.NullPointerException
at org.eclipse.jdt.internal.junit.ui.JUnitPlugin.getImageDescri ptor(JUnitPlugin.java:162)
at org.eclipse.jdt.internal.junit.wizards.NewTestCaseCreationWi zard.initializeDefaultPageImageDescriptor(NewTestCaseCreatio nWizard.java:37)
at org.eclipse.jdt.internal.junit.wizards.JUnitWizard.<init>(JUnitWizard.java:52)
at org.eclipse.jdt.internal.junit.wizards.NewTestCaseCreationWi zard. <init>(NewTestCaseCreationWizard.java:31)
at com.hsbc.es.cheatsheet.cdm.lab.reqresprocessing.action.Creat eJUnitTestCase.run(CreateJUnitTestCase.java:53)

When I try the same for NewClassCreationWizard it works fine.
Please advice what could be the problem.

Thanks and Regards
Abinash.
Re: Programmatically opening Junit test case creation wizard [message #325333 is a reply to message #325306] Thu, 14 February 2008 14:35 Go to previous messageGo to next message
Eclipse UserFriend
You need to execute the org.eclipse.ui.newWizard command with a
parameter (specifically,
newWizardId=org.eclipse.jdt.junit.wizards.NewTestCaseCreatio nWizard)

See IHandlerService and ParameterizedCommand, and
CommandContributionItem for an example of turning a commandId and a Map
into a ParameterizedCommand (in 3.4 it is a helper method on
ParameterizedCommand)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: Programmatically opening Junit test case creation wizard [message #325356 is a reply to message #325333] Fri, 15 February 2008 05:46 Go to previous message
Eclipse UserFriend
Originally posted by: abinashsahu.hsbc.co.in

Thanks a lot! I got where the error is.
Previous Topic:can we convert IFoler to IProject type??????
Next Topic:disable new wizards with activities
Goto Forum:
  


Current Time: Sat May 10 06:26:14 EDT 2025

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

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

Back to the top