How to programmatically execute a test suite using JUnit4?

前端 未结 2 521
粉色の甜心
粉色の甜心 2021-01-02 04:48

I am trying to invoke a JUnit Test suite using the API. I know that you can suite up test classes using the following:

@RunWith(Suite.class)
@Suite.SuiteClas         


        
2条回答
  •  鱼传尺愫
    2021-01-02 05:36

    Just specify the name of the suite class to JUnitCore:

    Computer computer = new Computer();
    
    JUnitCore jUnitCore = new JUnitCore();
    jUnitCore.run(computer, MySuite.class);
    

提交回复
热议问题