0

셀레늄 TestNG 클래스에는 method1, method2 등의 메소드가 있습니다. 각 메소드에 실패 조건과 성공 조건을 추가했습니다. 셀레늄 webdriver에서 어설 션 -falied 메소드 만 표시하고, 메소드는 전달하지 않음

public class TestNGClass { 

public void method1(String value) throws Exception { 

    if(value.equals("PASS"){ 
     org.testng.Assert.assertTrue(condition, message); 
    } 
} 

//This is another method 

public void method2(String value) throws Exception { 

    if(value.equals("FAIL"){ 
    org.testng.Assert.fail(message); 
    } 
} 

하지만 TestNG의 클래스 실행 후

는 테스트 출력 폴더에 "Index.html을"은 실패한 방법을 보여주는, 생성됩니다. 전달 된 메서드를 표시하는 방법 (사용자 지정 보고서).

Thank you 

답변

0

@Test 주석을 사용하여 테스트 메소드를 변환하십시오. 수정 된 코드 스 니펫 :

public class TestNGClass { 

@Test 
public void method1(){ 
    Assert.assertTrue(condition, "Your Message goes here"); 
} 

//This is another method 
@Test 
public void method2(){ 
    Assert.fail("Your Message goes here"); 
} 

이제 테스트 사례가보고됩니다.