问题描述
我创建了一个 TestNG 类 (FirstTest.java),当我将测试用例作为 TestNG Test 运行时,出现以下错误.
I created a TestNG class (FirstTest.java) and when I run the test case as TestNG Test, I am getting the following error.
在启动 FirstTest"期间发生内部错误.java.lang.NullPointerException
Eclipse 版本:Luna Service Release 2 (4.4.2)
Eclipse Version: Luna Service Release 2 (4.4.2)
如果有人知道请帮忙!
推荐答案
我今天遇到了类似症状的问题.我不确定这是否是同一个问题,但它与您问题中的所有内容相匹配.
I encountered a problem with similar symptoms today. I'm not sure if it is the same problem but it matches everything in your question.
就我而言,日志文件说:
In my case, the log files said:
!ENTRY org.eclipse.core.jobs 4 2 2015-12-03 15:49:19.369
!MESSAGE An internal error occurred during: "Launching NewTest".
!STACK 0
java.lang.NullPointerException
at org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getVMArgsFromPom(MavenTestNGLaunchConfigurationProvider.java:74)
所以我的问题是 Eclipse 中的 TestNG 插件未能找到 pom 文件,因为我不使用 Maven.无论如何,在卸载 TestNG Eclipse 插件的可选 M2E (Maven...) 部分后,我可以成功运行我的 TestNG 测试用例.
So my problem was that the TestNG-plugin in Eclipse failed to find the pom-file, as I don't use Maven. Anyway, after uninstalling the optional M2E (Maven...) part of the TestNG Eclipse plugin I could run my TestNG test cases successfully.
如果你有同样的问题,你在Eclipse中选择
If you have the same issue, you uninstall the M2E part in Eclipse by selecting
- 帮助
- 安装新软件...
- 已经安装了什么?
- 选择TestNG M2E软件并点击卸载
希望这有帮助!
这篇关于TestNG 启动时发生内部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!