简体   繁体   中英

How launch of certain TestSuite using the parameter in jUnit?

I have test classes wich use other test classes. It is necessary to run these classes depending on the transferred parameter in Jenkins. (For example: if jenkins get parameter testOne then start testsuite testOne. If jenkins get parameter testOther then start testsuite testOther and so on)
How can I implement this in jUnit?
This is an example of one of the test suites:

@RunWith(Categories.class)
@Suite.SuiteClasses({UserLogin.class,
        ExampleTests.class
        }
)
public class FirstTest {

I believe you can do something like that using junit test categories . For example, for running integration tests, you can configure a separate annotation for the tests.

Maven supports test categories.

Does it solve your problem or is the jenkins input parameter critical? If it is a jenkins parameter, I believe it is some environment/build configuration and you can customize your build (maven tests to be run) as per the the environment or build job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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