以 TestNG 身份运行未出现在 Eclipse 中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31158439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run as TestNG not appearing in Eclipse
提问by M06494h
I am trying to setup TestNG and run a sample test using TestNG. I have installed the TestNG plugin in Eclipse but when I try to run the test as TestNG, the option is not showing in 'Run As', it only shows Run As JUnit. Can anyone tell the reason why it is not appearing? or am I missing something?
我正在尝试设置 TestNG 并使用 TestNG 运行示例测试。我已经在 Eclipse 中安装了 TestNG 插件,但是当我尝试将测试作为 TestNG 运行时,该选项没有显示在“Run As”中,它只显示 Run As JUnit。谁能说出它不出现的原因?或者我错过了什么?
I tried uninstalling TestNG and re-installing it again, but no go..
我尝试卸载 TestNG 并重新安装它,但没有成功..
One more thing, am I not allowed to use JUnit and TestNG at the same time? My eclipse has got just the JUnit in Window -> Preferences -> Java -> JUnit but I can't see TestNG, why is this?
还有一件事,我是否不允许同时使用 JUnit 和 TestNG?我的 eclipse 在 Window -> Preferences -> Java -> JUnit 中只有 JUnit 但我看不到 TestNG,这是为什么?
Please advise.
请指教。
Thanks.
谢谢。
采纳答案by M06494h
As a workaround, I tried to install 'eclipse-jee-mars-R-win32-x86_64' and upgraded JDK from 1.6 to 1.7, it worked for me. So right now am not using Eclipse Luna anymore. Doing this will not disturb your Workspace. All your projects remains same. Only thing is you need to point eclipse to your previous Workspace itself.
作为一种解决方法,我尝试安装 'eclipse-jee-mars-R-win32-x86_64' 并将 JDK 从 1.6 升级到 1.7,它对我有用。所以现在我不再使用 Eclipse Luna。这样做不会干扰您的工作区。您的所有项目都保持不变。唯一的问题是您需要将 eclipse 指向您以前的工作区本身。
Thanks all for your comments.
感谢大家的意见。