构建Eclipse项目时自动运行JUnit [英] Run JUnit automatically when building Eclipse project

查看:116
本文介绍了构建Eclipse项目时自动运行JUnit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在保存Eclipse项目时自动运行我的单元测试。每当我保存文件时,该项目都会自动构建,所以我认为这应该是有可能的。



我该怎么办?是唯一的选择是获取一个蚂蚁脚本,并更改​​项目构建以使用蚂蚁脚本与目标构建编译



更新现在我将尝试两种不同的方法:


  1. 为我的项目运行一个额外的构建器

  2. ct-eclipse ,由Thorbjørn


解决方案

确定运行所有测试是不明智的,因为我们可以有例如20.000个测试,而我们的更改只能影响,我们说其中有50个,其中包括我们已经更改的类的测试,以及与我们的类协作的类的测试。



有一个非常简单的插件称为infinitetest http:// improvementworks.com/products/infinitest/ ,它仅在我们保存更改之后运行一些测试(与我们已更改的类相关)。它也很好地与编辑器(使用注释)和问题视图集成 - 显示不通过的测试,如错误。


I want to run my unit tests automatically when I save my Eclipse project. The project is built automatically whenever I save a file, so I think this should be possible in some way.

How do I do it? Is the only option really to get an ant script and change the project build to use the ant script with targets build and compile?

Update I will try 2 different approaches now:

  1. Running an additional builder for my project that executes the ant target test (I have an ant script anyway)
  2. ct-eclipse, recommended by Thorbjørn

解决方案

For sure it it unwise to run all tests, because we can have for example 20.000 tests whereas our change could affect only, let's say 50 of them, among which are tests for the class we have changed and tests for classes that collaborate with our class.

There is an unseful plugin called infinitetest http://improvingworks.com/products/infinitest/ which runs only some tests ( related to class we've changed ) just after we save changes. It also integrate quite nicely with editor ( using annotations ) and problem view - displaying not-passing tests like errors.

这篇关于构建Eclipse项目时自动运行JUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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