我正在使用 TestNG 来执行这个测试。在执行这个测试时,我得到执行整个测试所需的总时间。现在的要求是我需要记录从该测试执行的每个步骤所花费的时间。下面是我的自动化测试。这有 3 个步骤。
@Test(priority = 1, description = "Login to Oasis")
public void verifyFilter(){
//Step#1
navMenu = loginToApplication(username, password);
Assert.assertTrue(navMenu.isDisplayed(getWebDriverInstance()), "Login Failed!!!");
//Step#2
advancedSearchForm = navMenu.clickSearchAllTitles();
if (!advancedSearchForm.isDisplayed(getWebDriverInstance())) {
SimpleSearchFormElement simpleSearchForm = new SimpleSearchFormElement(getWebDriverInstance());
advancedSearchForm = simpleSearchForm.openAdvancedSearchForm();
}
Assert.assertTrue(advancedSearchForm.isDisplayed(getWebDriverInstance()), "Advanced Search Form is not displayed!");
//Step#3
collectionFilterDialog = advancedSearchForm.openCollectionFilterDialog();
boolean flag = collectionFilterDialog.isCollectionSelectableListDisplayed();
Assert.assertTrue(flag, "Collection Filer dialog is not displayed!");
}