TestNG(三) 基本注解BeforeMethod和AfterMethod


 

package com.course.testng;

import org.testng.annotations.*;

public class BasicAnnotation {
    @Test //最基本的注解,用來把方法標記為測試的一部分
    public void testCase1(){
        System.out.println("這個測試用例1");
    }

    @Test
    public void testCase2(){
        System.out.println("這個測試用例2");
    }
    @BeforeMethod
    public void beforMethod(){
        System.out.println("這是在測試前運行的");
    }

    @AfterMethod
    public void afterMethod(){
        System.out.println("這是在測試方法之后運行的");
    }

    @BeforeClass
    public void bedorClass(){
        System.out.println("這是類運行之前運行的方法");
    }

    @AfterClass
    public void afterClass(){
        System.out.println("這是類運行后執行的方法");
    }

}

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM