如何在 Eclipse 中知道 JUnit 的版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16729403/
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
How to know the version of JUnit in Eclipse
提问by Ripon Al Wasim
In eclipse:
在日食中:
- Window --> Preferences
- Expand Java at left side of panel --> JUnit is there under Java
- 窗口 --> 首选项
- 展开面板左侧的 Java --> Java 下有 JUnit
How can I know the version of JUnit in eclipse?
我如何知道eclipse中JUnit的版本?
回答by fortytwo
You can use this code:
您可以使用此代码:
import junit.runner.Version;
System.out.println("JUnit version is: " + Version.id());
回答by Raul Santelices
If you selected JUnit4 over JUnit3, the version that Eclipse uses is the one in eclipse/plugins/org.junit_XXXX. For Eclipse Luna, it is eclipse/plugins/org.junit_4.11.0.v201303080030. Note that if you want to change it, based on all the things I tried, you can replace the junit.jar contained inside with the version you want.
如果您选择 JUnit4 而不是 JUnit3,Eclipse 使用的版本是 eclipse/plugins/org.junit_XXXX 中的版本。对于 Eclipse Luna,它是 eclipse/plugins/org.junit_4.11.0.v201303080030。请注意,如果您想更改它,根据我尝试的所有内容,您可以将其中包含的 junit.jar 替换为您想要的版本。
回答by Rishikesh Dhokare
Go to the project properties --> java build path --> in libraries tab you will see the junit jar. see the version on it.
转到项目属性 --> java 构建路径 --> 在库选项卡中,您将看到 junit jar。看上面的版本。
回答by NPKR
what ever junit jar
you might have upload to build path
in eclipse
will be the version of junit
.
什么都junit jar
你可能有上传build path
的eclipse
将是版本junit
。
回答by Ravi Dutt
version of junit.jar will tell u the version of your JUNIT in eclipse. I think it may be
hidden in that jar
回答by Datta
If you are cloned existing maven project and you want to check on which version your tests will run then you can check Junit version in you pom.xml file.
如果您克隆了现有的 Maven 项目,并且想要检查测试将运行的版本,那么您可以在 pom.xml 文件中检查 Junit 版本。
If you print your junit version from code then it will print from your maven repository i.e. the version present in your pom.xml
如果您从代码打印您的 junit 版本,那么它将从您的 maven 存储库中打印,即您的 pom.xml 中存在的版本
import junit.runner.Version;
System.out.println("Version="+Version.id());
回答by haider
This morning I tried to run one of my test and I faced this issue.
今天早上我试图运行我的一个测试,我遇到了这个问题。
The best solution I found which fixed my issue is this :
我发现解决我的问题的最佳解决方案是:
Select your spring boot project name in Package Explorer Right Click Select Maven Update Project
在 Package Explorer 中选择您的 spring boot 项目名称右键单击选择 Maven 更新项目