harry335

一次运行多个测试类1-运行多个测试类

有两个测试类,叫CalculatorTestCalculatorTest2。在测试类所在的包中新建一个类,叫做TestAll,如下:

 

package com.mengdd.junit;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class TestAll extends TestCase
{

    public static Test suite()
    {
        // 创建一个测试套件
        TestSuite suite = new TestSuite();

        // 增加测试类的class对象
        suite.addTestSuite(CalculatorTest.class);
        suite.addTestSuite(CalculatorTest2.class);

        return suite;

    }
}

 

运行时,右键这个类,Run As ->JUnit Test

 

 

 

 

 

分类:

技术点:

相关文章:

  • 2021-05-09
  • 2021-12-09
  • 2022-03-03
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-10-12
  • 2021-11-03
  • 2021-11-03
相关资源
相似解决方案