使用Eclipse JUnit插件显示我的测试? [英] Display my tests using Eclipse JUnit plugin?

查看:131
本文介绍了使用Eclipse JUnit插件显示我的测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为公司特定的语言编写了一个测试框架。这个测试框架能够输出类似JUnit的XML。



例如,我可以将其保存到文件中,并使用Eclipse JUnit视图打开它,或者将其放在我的Hudson服务器中。我现在希望将其直接集成到我的Eclipse中,以便这些测试在Eclipse保存操作上运行,并将结果显示在JUnit视图中。



最好的方法是什么?




  • 将它们保存到文件并在Eclipse中打开该文件(如果是,请问如何处理?)

  • 直接使用XML内容填充JUnit视图? (如果是这样,怎么办?)

  • 创建自己的视图(我想做的,因为我是一个完整的SWT初学者)


解决方案

我没有尝试过这个我自己,但是我想,有一点诡计,这将是可能的在JUNit视图中自动打开格式正确的文件。



我想调用 org.eclipse.ui.ide.IDE.openEditor( IWorkbenchPage,URI,String,boolean)应该工作。这是因为JUnit格式的xml文件被设置为使用JUnit视图打开。



在您达成此目的之前,您需要创建一个Eclipse插件。这将是一个简单的插件,它将有一个类来监听测试框架的运行情况,另一个类将会知道在哪里可以找到生成的xml文件,并在其上调用openEditor。


I have written a test framework for a company-specific language. This test framework is able to output JUnit-like 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. 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.

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 ?)
  • Directly populate a JUnit view with content of XML ? (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)

解决方案

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.

I think a call to org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, URI, String, boolean) should work. This is because JUnit-formatted xml files are set to be opened with the JUnit view.

Before you get to this point, you need to create an Eclipse plugin. 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.

这篇关于使用Eclipse JUnit插件显示我的测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆