Junit是一个可编写重复测试的简单框架,是基于Xunit架构的单元测试框架的实例。Junit4最大的改进是大量使用注解(元数据),很多实际执行过程都在Junit的后台做完了,而且写test case 的类不需要继承TestCase,只需要在所要做test case的方法前加@Test 注解即可。

如:

1 import static org.junit.Assert.*;
2 2 public class TestCaculatorClass {
3 3     @Test
4 4     public void test() throws IOException, RuntimeException{
5 5         CaculatorClassForTest cal = new CaculatorClassForTest();
6 6         assertEquals(30, cal.sum(10, 20));
7 7     }
8 8 }
View @Test Code

相关文章:

  • 2021-12-25
  • 2021-12-25
  • 2021-09-16
  • 2022-01-07
  • 2021-04-08
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-07-27
  • 2021-06-15
  • 2021-06-26
  • 2021-09-23
  • 2021-12-10
  • 2021-12-01
相关资源
相似解决方案