开发者

how to export (JUnit) test suite as executable jar

开发者 https://www.devze.com 2023-02-03 05:54 出处:网络
Is there a way in eclipse (Helios) to package/export my JUnit test suites (or maybe even test cases if possible) a开发者_JAVA技巧s executable jars? I know how to generate runnable jars from projects w

Is there a way in eclipse (Helios) to package/export my JUnit test suites (or maybe even test cases if possible) a开发者_JAVA技巧s executable jars?

I know how to generate runnable jars from projects with a main class, but i'm clueless about how to include a TestRunner.

Is there a straightforward way, or do I have to make a workaround main class calling the TestRunner somehow?

Details would be great.


You are correct that a main() method is needed for an executable jar.

It's easy to add a main method to your test suite though.

public static void main(String[] args) throws Exception {                    
       JUnitCore.main(
         "com.stackoverflow.MyTestSuite");            
}
0

精彩评论

暂无评论...
验证码 换一张
取 消