我对Extent Reports有一个非常愚蠢的问题,但我没有得到单独的测试步骤
逻辑如下
1。@BeforeTest
在这里实例化所有内容
2。@Test
传递多个用户名并检查是否存在
3。@AfterTest
拆卸
4。@AfterMethod
刷新并打印报告
在上面的代码中,存在一些用户名,而有些用户名则不存在
当范围报告被打印时,它只是给出测试用例和总体状态的摘要
我如何从报告中了解哪些用户名已通过,哪些用户名未通过
以下是我的代码
@BeforeTest
public void instantiate()
{
System.setProperty("webdriver.ie.driver", "C:\\Eclipse\\IEDriverServer.exe");
DesiredCapabilities caps=new DesiredCapabilities();
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
driver=new InternetExplorerDriver(caps);
}
@Test(dataProvider="injectdataintovsslogin")
public void injectdataintowebsite(String username,String password) throws InterruptedException
{
report=new ExtentReports("C:/Users/v0c1344/workspace/VSSAutomation/Reports/Report.html");
logger=report.startTest("VSS Login");
driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("http://segotn11540.rds.volvo.com/vss_connect_testr1/Login/Login.aspx");
logger.log(LogStatus.INFO,"Test-R1 Url is working");
driver.findElement(By.xpath("//input[@name='UserNameInputText']")).sendKeys(username);
driver.findElement(By.xpath("//input[@name='Brand']")).sendKeys(password);
driver.findElement(By.xpath("//input[@name='CmdLogin']")).click();
Assert.assertTrue(isuserloggedin());
}
---------------检查用户是否存在的方法------------
public boolean isuserloggedin()
{
boolean flag = false;
if(!driver.findElements(By.id("Cancel")).isEmpty())
{
driver.findElement(By.id("Cancel")).click();
}
String title=driver.getTitle();
if(title.contains("VSS 4.0"))
{
flag=true;
logger.log(LogStatus.PASS, "User Exists");
}
else
{
logger.log(LogStatus.FAIL, "User Does not Exists");
}
return flag;
}
@AfterTest
public void teardown()
{
driver.quit();
}
-------------传递用户的逻辑在这里-----------
@DataProvider(name="injectdataintovsslogin")
public Object[][] wordpressinjectprofile() throws Exception
{
ReadExcelConfig file=new ReadExcelConfig("./Excel/TestAccount_Details_Test R11.xlsx");
int rows=file.rowcount(0);
Object[][] getdata=new Object[rows][2];
for(int i=0;i<rows;i++)
{
getdata[i][0]=file.getdata(0, i, 0);
getdata[i][1]=file.getdata(0, i, 1);
}
return getdata;
}
----------------打印报告------------------
@AfterMethod
public void printreport()
{
report.endTest(logger);
report.flush();
}
}
附上报告的屏幕截图
Report Image driver.get("C:/Users/v0c1344/workspace/VSSAutomation/Reports/Report.html");