简体   繁体   English

使用Eclipse JUnit插件显示我的测试?

[英]Display my tests using Eclipse JUnit plugin?

I have written a test framework for a company-specific language. 我为公司特定的语言编写了一个测试框架。 This test framework is able to output JUnit-like XML. 该测试框架能够输出类似JUnit的XML。

As an example, I can save it to file and open it using Eclipse JUnit view, or disp^lay it in my Hudson server. 作为一个例子,我可以将它保存到文件并使用Eclipse JUnit视图打开它,或者将它放在我的Hudson服务器中。 I want now to have it directly integrated in my Eclipse, in order for these tests to be run on Eclipse "save" action, and for their results to be displayed in a JUnit view. 我现在想要将它直接集成到我的Eclipse中,以便在Eclipse“save”操作上运行这些测试,并将它们的结果显示在JUnit视图中。

What is the best way to do that ? 最好的方法是什么?

  • Save them to file and open that file in Eclipse (and if so, how to do it ?) 将它们保存到文件并在Eclipse中打开该文件(如果是,如何操作?)
  • Directly populate a JUnit view with content of XML ? 使用XML内容直接填充JUnit视图? (and if so, how to do it ?) (如果是的话,怎么做?)
  • Create my own view (which I would like to do, as I'm a complete beginner in SWT) 创建我自己的视图(我想做的,因为我是SWT的完全初学者)

In my opinion the best way is create a simple Eclipse plugin, that shows your view. 在我看来,最好的方法是创建一个简单的Eclipse插件,显示您的视图。 Eclipse has a pretty good API to do that and there is a lot of documentation. Eclipse有一个非常好的API,并且有很多文档。 From my experience implementing Eclipse plugins, you don't need to be a good GUI designer since most controls are written and you can reuse it. 根据我实现Eclipse插件的经验,您不需要成为一个优秀的GUI设计器,因为大多数控件都是编写的,您可以重用它。

If you decide to take this way, here are some resources to start: 如果你决定采取这种方式,这里有一些资源可以开始:

Hope it helps. 希望能帮助到你。

I haven't tried this myself, but I imagine that with a little bit of trickery, it would be possible to automatically open a properly formatted file in the JUNit view. 我自己没有尝试过这个,但我想通过一些技巧,可以在JUNit视图中自动打开格式正确的文件。

I think a call to org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, URI, String, boolean) should work. 我认为对org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, URI, String, boolean)的调用应该有效。 This is because JUnit-formatted xml files are set to be opened with the JUnit view. 这是因为JUnit格式的xml文件设置为使用JUnit视图打开。

Before you get to this point, you need to create an Eclipse plugin. 在你到达这一点之前,你需要创建一个Eclipse插件。 This will be a simple plugin that will have one class that will listen for the completion of runs for your testing framework, and another class that will know where to find the resulting xml files and will call openEditor on it. 这将是一个简单的插件,它将有一个类将监听测试框架的运行完成,另一个类将知道在哪里找到生成的xml文件并将在其上调用openEditor。

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

相关问题 尝试使用SAX解析XML,但是我的JUnit测试都无法正常工作吗? - Attempting to parse XML using SAX, but none of my JUnit tests work? 在eclipse中运行JUnit测试后,我可以以XML格式导出结果。 如何使用JUnit命令行获取该xml文件? - After running JUnit tests in eclipse, I can export the result in XML format. How can I get that xml file using JUnit command line? 如何使用eclipse在我的junit selenium测试用例中解析xml文件 - How to parse xml file in my junit selenium test case using eclipse 需要 XSL 文件将内部 xml 测试格式转换为 Junit 格式(詹金斯的 xUnit 插件) - Need XSL file to convert internal xml tests format to Junit format (xUnit Plugin for jenkins) 如何编写 JUnit 测试(用于文件写入)? - How to write JUnit Tests (for Filewriting)? 我可以将我的plugin.xml文件的一部分分成多个Eclipse插件的xml文件吗? - Can I separate portions of my plugin.xml file into multiple xml files for an Eclipse plugin? 哪个Eclipse插件支持使用XML定义GUI - Which Eclipse plugin enables using XML to define GUI 从Gradle中的FileTree运行Junit测试 - Running Junit tests from a FileTree in Gradle 蚂蚁建立,但所有的junit测试失败 - Ant Builds but all of junit tests failing eclipse插件装饰器的问题 - issues with eclipse plugin decorator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM