我有三种@test方法来添加,更新和删除网页中的记录,执行完成后,我正在寻找类似以下的输出,在哪里可以使用sisout打印突出显示的消息,我正在运行我的TestNG中的代码。
@Test(priority=2)
void updateAddressBook() {
try{
driver.findElement(By.id("radio1")).click();
driver.findElement(By.id("edit")).click();
driver.findElement(By.id("company")).clear();
Thread.sleep(3000);
driver.findElement(By.id("company")).sendKeys("Vuram");
driver.findElement(By.id("add")).click();
Log.info("Validate company name is updated for user 2");
Reporter.log("Company name sucessfully updated for user 2");
passCount++;
} catch (Error e) {
verificationErrors.append("Cannot provide the input please stick to the UI constraints5.\n");
} catch(Exception e){
verificationErrors.append("Cannot provide the input please stick to the UI constraints6.\n");
}
try {
String x = driver.findElement(By.id("result")).getText();
if(x.contains("Vuram"));
{
passCount++;
}
} catch (Error e) {
verificationErrors.append("Element by id 'td' not found.\n");
} catch (Exception e) {
verificationErrors.append("Element by id 'td' not found.\n");
}
}
答案 0 :(得分:1)
这是您要寻找的解决方案,只需实施示例演示即可:
System.out.println();控制台日志
@Test(描述=“”)作为测试说明
public class demo {
@Test(description = "This is description of Test Case")
public void TestDemo() {
System.out.println("****************************");
System.out.println("Hello World");
System.out.println("****************************");
}
}