By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

how to generate extent report in java?

P: 20
how to generate extend report

Expand|Select|Wrap|Line Numbers
  1.  
  2.     WebDriver driver;
  3.     static ExtentTest test;
  4.     static ExtentReports report;
  5.  
  6.     @BeforeClass
  7.     public static void startTest()
  8.     {
  9.     report = new ExtentReports(System.getProperty("user.dir")+"\\ExtentReportResults.html");
  10.     test = report.startTest("OrangeHRM");
  11.     System.out.println("befor class");
  12.     }
  13.  
  14.     @AfterClass
  15.     public static void endTest()
  16.     {
  17.     report.endTest(test);
  18.     report.flush();
  19.     }
  20.  
  21.     //Add Candidates
  22.     @Given("^Open Url and login with valid  data$")
  23.     public void open_Url_and_login_with_valid_data() throws Throwable {
  24.         setProperties();
  25.         driver=login();
  26.     }
  27.     @When("^click on recruitment and candidates and verify page$")
  28.     public void click_on_recruitment_and_candidates_and_verify_page() throws Throwable {
  29.         driver.findElement(By.xpath("//*[@id='menu_recruitment_viewRecruitmentModule']/b")).click();
  30.         Thread.sleep(2000);
  31.         driver.findElement(By.xpath("//*[@id='menu_recruitment_viewCandidates']")).click();
  32.         Thread.sleep(2000);
  33.         String Expected_msg=driver.findElement(By.xpath("//*[@id='srchCandidates']/div[1]/h1")).getText();
  34.         String Actual_msg="Candidates";
  35.         Assert.assertEquals(Expected_msg, Actual_msg);
  36.         if(Expected_msg.equals(Actual_msg))
  37.         {
  38.             test.log(LogStatus.PASS, "test pass");
  39.         }
  40.  
  41.         else
  42.         {
  43.             test.log(LogStatus.FAIL, "Test Failed");
  44.         }
  45.     }
  46.     @Then("^click on add buttona and verify page$")
  47.     public void click_on_add_buttona_and_verify_page() throws Throwable {
  48.        driver.findElement(By.xpath("//*[@id='btnAdd']")).click();
  49.        Thread.sleep(2000);
  50.        String Expected_msg=driver.findElement(By.xpath("//*[@id='addCandidateHeading']")).getText();
  51.        String Actual_msg="Add Candidate";
  52.        Assert.assertEquals(Expected_msg, Actual_msg);
  53.     }
  54.     @Then("^Enter all required Detail$")
  55.     public void enter_all_required_Detail() throws Throwable {
  56.        driver.findElement(By.xpath("//*[@id='addCandidate_firstName']")).sendKeys("fname");
  57.        Thread.sleep(2000);
  58.        driver.findElement(By.xpath("//*[@id='addCandidate_middleName']")).sendKeys("mname");
  59.        Thread.sleep(2000);
  60.        driver.findElement(By.xpath("//*[@id='addCandidate_lastName']")).sendKeys("lname");
  61.        Thread.sleep(2000);
  62.        driver.findElement(By.xpath("//*[@id='addCandidate_email']")).sendKeys("abc@gmail.com");
  63.        Thread.sleep(2000);
  64.        driver.findElement(By.xpath("//*[@id='addCandidate_contactNo']")).sendKeys("4578963217");
  65.        Thread.sleep(2000);
  66.     }
  67.     @Then("^click on  Save Button and verify with success mag$")
  68.     public void click_on_Save_Button_and_verify_with_success_mag() throws Throwable {
  69.         driver.findElement(By.xpath("//*[@id='btnSave']")).click();
  70.         String Expected_msg="Successfully Saved"+"\n"+"Close";
  71.             String Actual_msg= driver.findElement(By.className("success")).getText();
  72.         Assert.assertEquals(Expected_msg, Actual_msg);
  73.     }
3 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,397
gosai jahnvi:

Why do you expect us to decipher your code and answer a question with so little information?

This is a very simple and basic question - did you do a google search? The following returned About 8,060,000 results in 0.97 seconds :(
https://www.google.com/search?client...ort+in+java%3F

So what specifically is it that you need?
What specifically are the issues you are encountering?
What specifically have you done in an attempt to solve those challenges?

Your questions really read like homework/course work questions and those are not allowed on this site.
3 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.