Generate the Advance level of Test Report of Selenium with Image using Scala

Generating the test report of test cases is the important part of selenium tool. When we write the test cases in selenium and execute the these test cases we always find the pass/fail result. so if we want to generate the report of these test cases in html format ,we can use the Extent Report .we will do just add the jar file of extent report in our project and call in our packages.

Add the jar files- extentreports-java-141.jar

package SeleniumTest
import java.util.concurrent.TimeUnit
import org.apache.pdfbox.pdfparser.PDFParser
import org.apache.pdfbox.util.PDFTextStripper
import org.openqa.selenium.firefox.FirefoxDriver
import org.scalatest.FlatSpec
import play.api.test.FakeApplication
import play.api.test.Helpers.HTMLUNIT
import play.api.test.Helpers.inMemoryDatabase
import play.api.test.Helpers.running
import play.api.test.TestServer
import setup.Testsetup
import com.relevantcodes.extentreports.ExtentReports
import com.relevantcodes.extentreports.LogStatus
import org.fest.assertions.Assert

class GenerateReport extends FlatSpec with Testsetup {

  running(TestServer(port, FakeApplication(additionalConfiguration = inMemoryDatabase())), HTMLUNIT) { browser =>

    "Application" should "Generate report" in {

       val knol = ExtentReports.get(classOf[GenerateReport])
       knol.init("/home/neeraj/Pictures/report.html", true)
       knol.startTest("Verify Page Title");
       val driver = new FirefoxDriver()
       knol.log(LogStatus.INFO, "Browser started")
       knol.log(LogStatus.INFO, "information with");
       val title=driver.getTitle();
       knol.log(LogStatus.INFO, "Get the current title");
       knol.log(LogStatus.INFO, "Browser closed");

generate report

when all the test case are successfully completed, a html report file is automatically will generate in giving folder whose screen shot we can seen in below image which is completely shown the pass fail status according to colour as well as if you want to  seen any image in your report so we can also attach these image in this report.

Screen shot of report.html-


This entry was posted in Scala. Bookmark the permalink.