Closed Rishek91 closed 7 years ago
Thanks a lot, My issue got Resolved hence I have closed this issue. please find below my code for the same.
package testcases;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.Assert; import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;
import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus;
import factory.BrowserFactory; import factory.DataProviderFactory; import pages.AmazonLogInPage; import utility.Helper;
public class VerifyAmazonLoginPage { public static WebDriver driver; public static ExtentReports reports; public static ExtentTest logger;
@BeforeTest
public void setup(){
reports=new ExtentReports(".\\Reports\\AdvancedReport.html",true);
logger= reports.startTest("Verify Amazon Home page","This will verify amazon home page");
driver=BrowserFactory.getBrowser("FireFox");
driver.get(DataProviderFactory.getConfig().getApplicationUrl());
logger.log(LogStatus.INFO,"Application is up and running");
}
@Test
public void AmazonLoginPage(){
AmazonLogInPage LogInPage=PageFactory.initElements(driver, AmazonLogInPage.class);
String expectedTitle=LogInPage.ApplicationgetTitel();
System.out.println("The title is "+expectedTitle);
Assert.assertEquals(expectedTitle,"Online Shopping: Shop Online for Mobiles, Books, Watches, Shoes and More - Amazon.in");
logger.log(LogStatus.PASS,"Title verified successfully");
LogInPage.SignUp(DataProviderFactory.getExcel().getexceldata("LogIn",1,0),DataProviderFactory.getExcel().getexceldata("LogIn",1,1));
logger.log(LogStatus.INFO,"Login to the Application");
}
@AfterMethod
public void TearDown(ITestResult results){
if (results.getStatus()==ITestResult.FAILURE){
String path=Helper.CaptureScreenShot(driver,results.getName());
logger.log(LogStatus.FAIL,logger.addScreenCapture(path));
}
reports.endTest(logger); reports.flush(); BrowserFactory.closeBrowser(driver);
}
}
Hi , I am unable to Generate Advanced reports using maven with ExtentReports dependency and the same code is working with TestNG, Please help me on the same. Please find below of my code which I have written to generate advanced reports in selenium Webdriver.
package testcases;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.Assert; import org.testng.ITestResult; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;
import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus;
import factory.BrowserFactory; import factory.DataProviderFactory; import pages.AmazonLogInPage; import utility.Helper;
public class VerifyAmazonLoginPage {
}
Please find attached pom POM.txt .XML as well.