单元测试框架 TestNG

码农软件 · 软件分类 · 程序调试工具 · 2019-12-01 22:42:47

软件介绍

JUnit 框架是 Java 语言单元测试当前的一站式解决方案。这个框架值得称赞,因为它把测试驱动的开发思想介绍给 Java 开发人员并教给他们如何有效地编写单元测试。但是,在过去的几年中,JUnit 的改进不大;所以,为当今复杂的环境编写测试已经变成一个越来越困难的任务,即 JUnit 必须与其他一些补充性测试框架集成起来。而 TestNG 是一个测试 Java 应用程序的新框架。TestNG 不仅确实强大、创新、可扩展、灵活,它还展示了 Java Annotations(JDK 5.0 中的重大新特性)的有趣应用。

TestNG 的创造者是 Cedric Beust,他在 Java 编程领域非常出名,是 EJB 3 专家组的成员,也是其他一些流行的开源项目(例如 EJBGen 和 Doclipse)的创造者。

示例测试代码:

package example1;

import org.testng.annotations.*;

public class SimpleTest {

 
@BeforeClass
 
public void setUp() {
   
// code that will be invoked when this test is instantiated
 
}

 
@Test(groups = { "fast" })
 
public void aFastTest() {
   
System.out.println("Fast test");
 
}

 
@Test(groups = { "slow" })
 
public void aSlowTest() {
   
System.out.println("Slow test");
 
}

}

本文地址:https://codercto.com/soft/d/20231.html

Developing Large Web Applications

Developing Large Web Applications

Kyle Loudon / Yahoo Press / 2010-3-15 / USD 34.99

As web applications grow, so do the challenges. These applications need to live up to demanding performance requirements, and be reliable around the clock every day of the year. And they need to withs......一起来看看 《Developing Large Web Applications》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具