简体   繁体   English

从Eclipse中运行的JUnit测试中检测Eclipse版本

[英]Detect Eclipse version from JUnit test running in Eclipse

I'm running a series of system tests developed with Java and JUnit within Eclipse , using the Eclipse console as output. 我正在运行一系列使用Eclipse控制台作为输出在Eclipse中使用JavaJUnit开发的系统测试。 I'm planning to implementing better console output for some tests using some console characters, which are not supported before Eclipse Mars ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=76936 ). 我计划使用某些控制台字符为某些测试实现更好的控制台输出,在Eclipse Mars之前不支持这些控制台字符( https://bugs.eclipse.org/bugs/show_bug.cgi?id=76936 )。

To ensure compatibility with colleagues running an older version of Eclipse , I would need to detect the Eclipse version in the JUnit test programatically . 为了确保与运行旧版Eclipse同事兼容,我需要以编程方式在JUnit测试中检测Eclipse版本 Is this possible and if yes, how? 这可能吗?如果可以,怎么办?

System.getProperty("eclipse.buildId");

将为您提供Eclipse构建ID,类似于

4.4.2.M20150204-1700

您可以通过Java属性获得它:

System.getProperty("eclipse.buildId").

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM