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 m开发者_如何学Pythonethod to accomplish the same purpose?
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?
<batchtest ...>
<fileset dir="testclasses">
<include name="com/foo/bar/team1/**/*.class"/>
</fileset>
</batchtest>
or
<batchtest ...>
<fileset dir="testclasses/team1">
<include name="**/*.class"/>
</fileset>
</batchtest>
What if using TestSuite? Then use ant to execute only desired TestSuites that you want in different occasions.
精彩评论