TestNG를 사용하여 셀렌을 처음 사용합니다. 네가 나를 대답 할 수 있다면 큰 도움이 될 것이다. 나는 텍스트 노트를 생성 할 webApplication을위한 테스트 케이스를 작성하고있다. 여러 종류의 입력을 테스트하기 위해 @dataProvider를 사용했습니다. 모든 값을 입력 한 후 두 가지 옵션을 사용할 수 있습니다. 즉 저장하거나 메모 작성을 취소 할 수 있습니다. 나는 예외를 던지고있는 @optional annotation을 사용했다. @dataprovider를 @optional annotation으로 사용할 수 있는지 설명해 주시겠습니까? 나는 이와 같은 코드를 작성했다.셀레늄 With TestNG
@Test
public class CreateNotesTest extends BeginAndEndTest
{
@Test(dataProvider = "createNotes", dataProviderClass = CreateNotesTest.class)
public void createsNotes(String title,String content,String tags,@Optional("save") String action)
{
WebDriver driver = getDriver();
CreateNotes notes = new CreateNotes(driver);
boolean status = notes.createNote(title, content, tags, action);
if(action.equalsIgnoreCase("save") || action.equals(""))
{
Assert.assertEquals(status, true);
}
else
Assert.assertEquals(status, false);
}
/**
*
* @return dataProvider
*/
@DataProvider(name = "createNotes")
public static Object[][] getNotesData()
{
return new Object[][]{{"test1","my family is my first priority","family"},{"","hello","greeting","cancel"}};
}
답장을 보내 주셔서 감사합니다. – geeth