zoukankan      html  css  js  c++  java
  • Junit

    各种注解的含义:

    @Before:初始化方法   对于每一个测试方法都要执行一次(注意与BeforeClass区别,后者是对于所有方法执行一次)
    @After:释放资源  对于每一个测试方法都要执行一次(注意与AfterClass区别,后者是对于所有方法执行一次)
    @Test:测试方法,在这里可以测试期望异常和超时时间 
    @Test(expected=ArithmeticException.class)检查被测方法是否抛出ArithmeticException异常 
    @Ignore:忽略的测试方法 
    @BeforeClass:针对所有测试,只执行一次,且必须为static void 
    @AfterClass:针对所有测试,只执行一次,且必须为static void 


    一个JUnit4的单元测试用例执行顺序为: 
      @BeforeClass -> @Before -> @Test -> @After -> @AfterClass; 
    每一个测试方法的调用顺序为: 

      @Before -> @Test -> @After; 

  • 相关阅读:
    Vue自定义指令 directive
    Vue过滤器 filters
    贪心
    家庭作业
    线段
    数列极差
    shell
    智力大冲浪
    加工生产调度
    喷水装置
  • 原文地址:https://www.cnblogs.com/chen--biao/p/10006232.html
Copyright © 2011-2022 走看看