JUnit 4测试套件 [英] JUnit 4 Test Suites

查看:92
本文介绍了JUnit 4测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用JUnit 4创建测试套件?

How do I create test suites with JUnit 4?

我看过的所有文档似乎都不适用于我.而且,如果我使用Eclipse向导,它不会为我提供选择已创建的任何测试类的选项.

All the documentation I've seen doesn't seem to be working for me. And if I use the Eclipse wizard it doesn't give me an option to select any of the test classes I have created.

推荐答案

import org.junit.runners.Suite;
import org.junit.runner.RunWith;

@RunWith(Suite.class)
@Suite.SuiteClasses({TestClass1.class, TestClass2.class})
public class TestSuite {
  //nothing
}

这篇关于JUnit 4测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆