使用 Ant 仅运行特定的 JUnit 测试
我们目前已经建立了一个项目,并有 4 个团队负责该项目的不同部分。我想要运行 5 个 ant 目标。每个团队一份,另外一份用于生产。但我想在我的测试中设置一个枚举来确定运行哪些测试。
例如,如果测试有。
runConfiguration = RunConfigurations.PRODUCTION;
然后我将运行它以仅针对该特定的蚂蚁目标运行。 如果我这样做,其他测试也会运行:
runConfiguration = RunConfigurations.TEAM1;
等等。
是否可以在 ant 中创建一个批量测试来仅运行具有特定枚举值的测试,如下所示?或者是否有另一种方法可以实现相同的目的?
We currently have a project set up and have 4 teams working on different parts of it. I am wanting to have 5 ant targets to run. One for each team and one additional for production. But I would like to set an enum in my tests to determine which tests are run.
For example, if a test has.
runConfiguration = RunConfigurations.PRODUCTION;
Then I would run it to only run for that specific ant target.
And other tests would run if I did:
runConfiguration = RunConfigurations.TEAM1;
etc.
Is it possible in ant to create a batchtest to only run test with a specific enum value like this? Or is there perhaps another method to accomplish the same purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,你不能那样做。资源集合仅定义要作为测试运行的 java 或类文件集。
为什么不简单地将测试组织在包中,甚至每组测试都有一个源/目标目录?
或者
No, you won't be able to do that. The resource collection simply defines the set of java or class files to run as test.
Why don't you simply organize your tests in packages, or even have one source/target directory per set of tests?
or
如果使用 TestSuite 会怎样?然后使用 ant 在不同场合只执行您想要的 TestSuite。
What if using TestSuite? Then use ant to execute only desired TestSuites that you want in different occasions.