Run all tests in Junit 4

前端 未结 7 1460
感动是毒
感动是毒 2021-02-01 15:45

I want to be able to run all tests in a project programmatically. I know Eclipse has a \"Run as JUnit test\" configuration which somehow grabs all the tests in a project and run

7条回答
  •  南方客
    南方客 (楼主)
    2021-02-01 16:13

    You can do this fairly easily from within maven using the surefire plugin: I usually clean/compile/install my projects from the command line before comparing them for eclipse usage (mvn eclipse:clean eclipse:eclipse) and you can define a test suite in your pom which lists all the tests you want to run en masse every time you run mvn install. You're not calling them programatically, exactly, but you can certainly call them en masse.

提交回复
热议问题