简体   繁体   English

在Ant JUnit测试运行中仅运行类型的子类

[英]Run Only Subclasses of a Type in an Ant JUnit test run

Hi is it possible with Ant to define a target that will only run JUnit tests that are a subclass of a given type. 您好,Ant可以定义仅运行属于给定类型的子类的JUnit测试的目标。

The scenario is: in the project I have joined we have a large number of Integration tests that are not run separately from the Unit tests, and I'd like to define an Ant task to run them in a separate build stage from the unit tests, and ultimately in a separate Jenkins build. 场景是:在我加入的项目中,我们有大量的集成测试,这些测试不是与单元测试分开运行的,我想定义一个Ant任务来在与单元测试分开的构建阶段中运行它们,最终在单独的Jenkins构建中。 However, there are no naming or packaging conventions for these Integration Tests so the standard Ant path matching won't work in this scenario. 但是,这些集成测试没有命名或打包约定,因此标准Ant路径匹配在这种情况下不起作用。

What I think I need to achieve what I want, is a task def that will allow me to say something like: 我认为我需要实现的目标是一个任务定义,该任务定义使我能够说出类似以下内容:

<include name="? extends IntegrationBaseTest"/>

This is obviously a contrived example, but I belive it communicates what I want. 这显然是一个人为的例子,但是我相信它传达了我想要的东西。

Has anyone implemented something like this or is it possible with Ant out-of-the-box? 有没有人实施过类似的事情,或者Ant可以立即使用吗?

I don't think you can do this with Ant. 我认为您无法使用Ant做到这一点。 Perhaps JUnit categories can help segregate your tests. 也许JUnit类别可以帮助隔离测试。

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

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