How to programmatically execute a test suite using JUnit4?

前端 未结 2 508
粉色の甜心
粉色の甜心 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:33

    You can also that using command prompt as

    java org.junit.runner.JUnitCore test class name

    0 讨论(0)
  • 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);
    
    0 讨论(0)
提交回复
热议问题