如果我创建一个通过testng使用的测试类,一切都按预期正常工作。如果我然后尝试通过.xml文件运行此测试,那么我得到以下错误日志。我确定我的所有包和类都标记正确。我尝试过卸载并重新安装eclipse并创建新的工作区,并尝试使用多个不同的类和包,但我总是得到同样的错误。
我在64位Windows 7上运行Eclipse Mars。
感谢。
将发送以下数据:
------
STATUS
------
pluginId org.eclipse.ui
pluginVersion 3.107.0.v20150507-1945
code 0
severity 4
message Unhandled event loop exception
fingerprint 3ed0857c
Exception:java.lang.NullPointerException: null
at HIDDEN.HIDDEN(HIDDEN:-1)
at HIDDEN.HIDDEN(HIDDEN:-1)
at HIDDEN.HIDDEN(HIDDEN:-1)
at HIDDEN.HIDDEN(HIDDEN:-1)
at HIDDEN.HIDDEN(HIDDEN:-1)
at HIDDEN.HIDDEN(HIDDEN:-1)
at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.launch(LaunchShortcutExtension.java:431)
at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.run(LaunchShortcutAction.java:74)
at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.runWithEvent(LaunchShortcutAction.java:123)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1137)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1122)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:788)
at org.eclipse.jface.action.ActionContributionItem$9.handleEvent(ActionContributionItem.java:1293)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(null:-2)
at sun.reflect.NativeMethodAccessorImpl.invoke(null:-1)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(null:-1)
at java.lang.reflect.Method.invoke(null:-1)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
------
REPORT
------
anonymousId 3741d217-639d-4c96-970a-231ce281c5eb
name
email
comment
eclipseBuildId 4.5.1.M20150904-0015
eclipseProduct org.eclipse.epp.package.jee.product
javaRuntimeVersion 1.8.0_60-b27
osgiWs win32
osgiOs Windows7
osgiOsVersion 6.1.0
osgiArch x86_64
logMessage false
ignoreSimilar false
-------
BUNDLES
-------
name org.eclipse.core.databinding.observable
version 1.5.0.v20150422-0725
name org.eclipse.core.databinding
version 1.5.0.v20150422-0725
name org.eclipse.core.runtime
version 3.11.1.v20150903-1804
name org.eclipse.debug.ui
version 3.11.100.v20150731-1137
name org.eclipse.e4.ui.workbench
version 1.3.0.v20150531-1948
name org.eclipse.e4.ui.workbench.swt
version 0.13.0.v20150504-0621
name org.eclipse.equinox.app
version 1.3.300.v20150423-1356
name org.eclipse.equinox.launcher
version 1.3.100.v20150511-1540
name org.eclipse.jface
version 3.11.0.v20150602-1400
name org.eclipse.swt
version 3.104.1.v20150825-0743
name org.eclipse.ui
version 3.107.0.v20150507-1945
name org.eclipse.ui.ide.application
version 1.1.0.v20150422-0725
name org.eclipse.ui.ide
version 3.11.0.v20150825-2158
name org.testng.eclipse
version 6.9.7.201510070420
答案 0 :(得分:0)
这是我正在使用的课程:
package Test1;
import org.testng.annotations.Test;
public class NewTest {
@Test
public void testOne() {
System.out.println("Run this.");
}
}
然后我右键单击该类,导航到TestNG并转换为TestNG。
testng.xml然后出现在我的项目文件夹下(不在项目的任何子文件夹中),testng.xml读作
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="none">
<test name="Test">
<classes>
<class name="Test1.NewTest"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
答案 1 :(得分:0)
当前版本的Eclipse Mars(v4.5)与TestNG()的组合确实有bug。请参阅错误中的评论,因为有workaround。
使用类似解决方法的同样问题:Run as TestNG Suite not working in eclipse。