Run JUnit tests automatically in Jenkins without maven or ant

前端 未结 1 477
失恋的感觉
失恋的感觉 2020-12-30 08:08

I am currently setting up a continuous integration tool with Jenkins. I would like to run JUnit tests everytime a build is made. My problem is that none of the projects that

相关标签:
1条回答
  • 2020-12-30 08:45

    Have you tried ClasspathSuite by Johannes Link?

    From the documentation:

    The mechanism is simple. Just create a new project in Eclipse and add all projects that contain tests you want to run to its build path. Now create a class like that:

    import org.junit.extensions.cpsuite.ClasspathSuite;
    import org.junit.runner.RunWith;
    @RunWith(ClasspathSuite.class)
    public class MySuite {}
    

    This will execute all JUnit4 testclasses (those containing methods with the @Test annotation) in the projects classpath.

    You can then run it using JUnitCore.

    java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore [test class name]
    

    For more information, see How to run Junit testcases from command line?.

    0 讨论(0)
提交回复
热议问题