<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Extent Reports-Java-Version3 Archives | Selenium Webdriver Appium Complete Tutorial</title>
	<atom:link href="https://automationtesting.in/category/extent-reports-java-version3/feed/" rel="self" type="application/rss+xml" />
	<link>https://automationtesting.in/category/extent-reports-java-version3/</link>
	<description>Automation Testing</description>
	<lastBuildDate>Sun, 26 Mar 2017 08:10:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.2</generator>
	<item>
		<title>Extent Report With Multiple Classes</title>
		<link>https://automationtesting.in/extent-report-with-multiple-classes/</link>
					<comments>https://automationtesting.in/extent-report-with-multiple-classes/#comments</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Sat, 25 Feb 2017 07:17:01 +0000</pubDate>
				<category><![CDATA[Extent Reports-Java-Version3]]></category>
		<category><![CDATA[advanced reports]]></category>
		<category><![CDATA[advanced selenium reports]]></category>
		<category><![CDATA[create extent reports]]></category>
		<category><![CDATA[extent report with multiple classes]]></category>
		<category><![CDATA[how to get extent report from multiple classes]]></category>
		<category><![CDATA[how to get extent report with multiple classes]]></category>
		<category><![CDATA[HTML Reports]]></category>
		<category><![CDATA[multiple classes report]]></category>
		<category><![CDATA[report from multiple classes]]></category>
		<category><![CDATA[report with multiple classes]]></category>
		<category><![CDATA[rich html reports]]></category>
		<category><![CDATA[selenium reports]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1408</guid>

					<description><![CDATA[<p>Extent Report with Multiple classes will discuss about how to create a single report when you have multiple classes. Usually people will face issue that they will get the report with single class as all the extent reports related classes will be in the same class but when they have multiple classes then they might [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/extent-report-with-multiple-classes/">Extent Report With Multiple Classes</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/02/GENERATE-EXTENT-REPORT-WITH-MULTIPLE-CLASSES-JAVA.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">Extent Report with Multiple classes will discuss about how to create a single report when you have multiple classes. Usually people will face issue that they will get the report with single class as all the extent reports related classes will be in the same class but when they have multiple classes then they might not get the single report for all the methods which are there in the different classes. </span></p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/QQAmcnGbVQM?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p><span style="font-weight: 400;">To overcome this issue, we need to create a separate class to declare the extent reports related classes and need to extend that class to access the object of those classes in each class where we need to generate the report for the test methods. </span></p>
<p><span style="font-weight: 400;">To show this, here we will create a class(i.e. </span><b>BaseTest</b><span style="font-weight: 400;">) to declare the extent reports related classes and will create 2 more classes(i.e. </span><b>Functionality1 </b><span style="font-weight: 400;">and</span><b> Functionality2</b><span style="font-weight: 400;">) to access these objects and will create a single report from these two classes.</span></p>
<p><span style="font-weight: 400;">The most important thing here is, once you create an object to the extent report classes we need to access the same object in different classes for this we have declare these variables as static then all the instances share the same copy of that variable. And a class variable can be accessed directly with the class, without the need to create an instance.</span></p>
<p><span style="font-weight: 400;">Below is the </span><b>BaseTest</b><span style="font-weight: 400;"> class where we can declare the classes which are required to generate the extent reports and will configure the basic information for the report how it should generate. As we know that extent reports will use TestNG to generate the reports. Basic configuration is single time activity so we will put that code in </span><b>@BeforeSuite</b><span style="font-weight: 400;"> and </span><b>@AfterSuite</b><span style="font-weight: 400;"> annotations. And will run the code using </span><b>testng.xml</b><span style="font-weight: 400;"> file as we need to run multiple classes at a time.</span></p>
<pre class="brush: java; highlight: [17,18,19,24,25,26,28,29,30,31,33,34,35,36,37,45,46,50,54,55,62]; title: ; notranslate">
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.ChartLocation;
import com.aventstack.extentreports.reporter.configuration.Theme;

public class BaseTest
{
    public static ExtentHtmlReporter htmlReporter;
    public static ExtentReports extent;
    public static ExtentTest test;
    
    @BeforeSuite
    public void setUp()
    {
        htmlReporter = new ExtentHtmlReporter(System.getProperty(&quot;user.dir&quot;) +&quot;/test-output/MyOwnReport.html&quot;);
        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
        
        extent.setSystemInfo(&quot;OS&quot;, &quot;Mac Sierra&quot;);
        extent.setSystemInfo(&quot;Host Name&quot;, &quot;Krishna&quot;);
        extent.setSystemInfo(&quot;Environment&quot;, &quot;QA&quot;);
        extent.setSystemInfo(&quot;User Name&quot;, &quot;Krishna Sakinala&quot;);
        
        htmlReporter.config().setChartVisibilityOnOpen(true);
        htmlReporter.config().setDocumentTitle(&quot;AutomationTesting.in Demo Report&quot;);
        htmlReporter.config().setReportName(&quot;My Own Report&quot;);
        htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
        htmlReporter.config().setTheme(Theme.DARK);
    }
    
    @AfterMethod
    public void getResult(ITestResult result)
    {
        if(result.getStatus() == ITestResult.FAILURE)
        {
            test.log(Status.FAIL, MarkupHelper.createLabel(result.getName()+&quot; Test case FAILED due to below issues:&quot;, ExtentColor.RED));
            test.fail(result.getThrowable());
        }
        else if(result.getStatus() == ITestResult.SUCCESS)
        {
            test.log(Status.PASS, MarkupHelper.createLabel(result.getName()+&quot; Test Case PASSED&quot;, ExtentColor.GREEN));
        }
        else
        {
            test.log(Status.SKIP, MarkupHelper.createLabel(result.getName()+&quot; Test Case SKIPPED&quot;, ExtentColor.ORANGE));
            test.skip(result.getThrowable());
        }
    }
    
    @AfterSuite
    public void tearDown()
    {
        extent.flush();
    }
}
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><span style="font-weight: 400;">Below is the class1 (i.e. </span><b>Functionality1</b><span style="font-weight: 400;">) which will have actual test cases/scripts and need to generate the report for the status of the test methods under this class. So, we will extend the BaseTest to this class to access the extent report related classes. </span></p>
<pre class="brush: java; highlight: [4,9,16,23]; title: ; notranslate">
import org.testng.Assert;
import org.testng.annotations.Test;

public class Functionality1 extends BaseTest
{
    @Test
    public void functionality1Test1()
    {
        test = extent.createTest(&quot;functionality1Test1&quot;);
        Assert.assertTrue(1 &gt; 0);
    }
    
    @Test
    public void functionality1Test2()
    {
        test = extent.createTest(&quot;functionality1Test2&quot;);
        Assert.assertEquals(&quot;Krishna&quot;, &quot;Sakinala&quot;);
    }
    
    @Test
    public void functionality1Test3()
    {
        test = extent.createTest(&quot;functionality1Test3&quot;);
        Assert.assertNotEquals(&quot;Krishna&quot;, &quot;Krishna&quot;);
    }
}
</pre>
<p><span style="font-weight: 400;">Below is the class2 (i.e. </span><b>Functionality2</b><span style="font-weight: 400;">) which will have actual test cases/scripts and need to generate the report for the status of the test methods under this class. So, we will extend the BaseTest to this class to access the extent report related classes. </span></p>
<pre class="brush: java; highlight: [4,9,16,23]; title: ; notranslate">
import org.testng.Assert;
import org.testng.annotations.Test;

public class Functionality2 extends BaseTest
{
    @Test
    public void functionality2Test1()
    {
        test = extent.createTest(&quot;functionality2Test1&quot;);
        Assert.assertTrue(1 &gt; 0);
    }
    
    @Test
    public void functionality2Test2()
    {
        test = extent.createTest(&quot;functionality2Test2&quot;);
        Assert.assertEquals(&quot;Krishna&quot;, &quot;Sakinala&quot;);
    }
    
    @Test
    public void functionality2Test3()
    {
        test = extent.createTest(&quot;functionality2Test3&quot;);
        Assert.assertNotEquals(&quot;Krishna&quot;, &quot;Krishna&quot;);
    }
}
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><span style="font-weight: 400;">Now we will run the both classes using </span><b>testng.xml</b><span style="font-weight: 400;"> file and will get the consolidated report for both the classes. Can find the same report below:</span></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2017/02/Report-from-Multiple-Classes.png"><img decoding="async" loading="lazy" class="size-full wp-image-1410 aligncenter" src="https://automationtesting.in/wp-content/uploads/2017/02/Report-from-Multiple-Classes.png" alt="Report from Multiple Classes" width="1365" height="660" srcset="https://automationtesting.in/wp-content/uploads/2017/02/Report-from-Multiple-Classes.png 1365w, https://automationtesting.in/wp-content/uploads/2017/02/Report-from-Multiple-Classes-300x145.png 300w, https://automationtesting.in/wp-content/uploads/2017/02/Report-from-Multiple-Classes-768x371.png 768w, https://automationtesting.in/wp-content/uploads/2017/02/Report-from-Multiple-Classes-1024x495.png 1024w" sizes="(max-width: 1365px) 100vw, 1365px" /></a></p>
<p><span style="font-weight: 400;">This way we can generate the single report from multiple classes.</span></p>
<p><span style="font-weight: 400;">Please watch the YouTube video of this blog for better understanding.</span><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1408" data-postid="1408" class="themify_builder_content themify_builder_content-1408 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/extent-report-with-multiple-classes/">Extent Report With Multiple Classes</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/extent-report-with-multiple-classes/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Capture FullPage Screenshot in Extent Reports &#8211; Java</title>
		<link>https://automationtesting.in/capture-fullpage-screenshot-in-extent-reports-java/</link>
					<comments>https://automationtesting.in/capture-fullpage-screenshot-in-extent-reports-java/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Sat, 25 Feb 2017 03:52:57 +0000</pubDate>
				<category><![CDATA[Extent Reports-Java-Version3]]></category>
		<category><![CDATA[advanced reports]]></category>
		<category><![CDATA[advanced selenium reports]]></category>
		<category><![CDATA[capture full page screenshot in selenium]]></category>
		<category><![CDATA[capture fullpage screenshot in extent reports]]></category>
		<category><![CDATA[create extent reports]]></category>
		<category><![CDATA[extent reports screenshot]]></category>
		<category><![CDATA[full page screenshot]]></category>
		<category><![CDATA[how to get screenshot in selenium]]></category>
		<category><![CDATA[HTML Reports]]></category>
		<category><![CDATA[report screenshot]]></category>
		<category><![CDATA[rich html reports]]></category>
		<category><![CDATA[screenshot in extent reports]]></category>
		<category><![CDATA[screenshot in html report]]></category>
		<category><![CDATA[screenshot in report]]></category>
		<category><![CDATA[selenium reports]]></category>
		<category><![CDATA[selenium screenshot]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1400</guid>

					<description><![CDATA[<p>Capture Screenshot in Extent Reports will discuss about capturing the screenshot of a particular failure step in the HTML report.  In our previous blog we have seen how to log the messages in the report. Same way here we will capture the screenshot for a particular failure step. The screenshot will give the information about [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/capture-fullpage-screenshot-in-extent-reports-java/">Capture FullPage Screenshot in Extent Reports &#8211; Java</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/02/CAPTURE-FULL-PAGE-SCREENSHOTS-IN-EXTENT-REPORTS-JAVA.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">Capture Screenshot in Extent Reports will discuss about capturing the screenshot of a particular failure step in the HTML report.  In our previous blog we have seen how to </span><a href="https://automationtesting.in/extent-reports-log-generation-java-version3/"><span style="font-weight: 400;">log</span></a><span style="font-weight: 400;"> the messages in the report. Same way here we will capture the screenshot for a particular failure step. The screenshot will give the information about on which screen the script  got failed during the execution. Then we can easily identify the issue by looking into the report.</span></p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/B9tAagM2lCI?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p><span style="font-weight: 400;">But the issue from Selenium 3 is; it will not capture the full screenshot of the particular page rather it will capture only the visible area of the web page. But sometimes we need to capture full page of the particular web page. Then we can not use the normal screenshot functionality which is provided by the selenium. For this we will use Ashot to capture the full page screenshot of the particular web page. In one of our </span><a href="https://automationtesting.in/taking-full-page-screenshot-in-selenium/"><span style="font-weight: 400;">previous blogs</span></a><span style="font-weight: 400;"> we have seen how to capture the same using Ashot. In this blog, we will use Ashot functionality and make that available in the extent reports.</span></p>
<p><span style="font-weight: 400;">For this we need to use the </span><b>log()</b><span style="font-weight: 400;"> method of </span><b>ExtentTest</b><span style="font-weight: 400;"> class. To log the screenshot in the report we need to pass the path of the screenshot to the log method as a parameter. So, before logging the screenshot to the report we need to capture the full page screenshot of that particular failure and place it in a folder, from there we need to get the path of the screenshot file and pass it to the log method.</span></p>
<p><strong>Below is the sample program to capture screenshot in the report:</strong></p>
<pre class="brush: java; highlight: [19,20,21,27,28,29,35,48,49,50,51,55,59,60,62]; title: ; notranslate">
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;

public class CapturingFullPageScreenshot
{
    ExtentHtmlReporter htmlReporter;
    ExtentReports extent;
    ExtentTest test;
    WebDriver driver;
    
    @BeforeTest
    public void config()
    {
        htmlReporter = new ExtentHtmlReporter(System.getProperty(&quot;user.dir&quot;) +&quot;/test-output/MyOwnReport.html&quot;);
        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
    }
    
    @Test
    public void captureScreenshot()
    {
        test = extent.createTest(&quot;captureScreenshot&quot;);
        System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;/KRISHNA VOLUME/drivers/geckodriver&quot;);
        driver = new FirefoxDriver();
        driver.get(&quot;https://automationtesting.in&quot;);
        String title = driver.getTitle();
        Assert.assertEquals(&quot;Home - Automation Test&quot;, title);
    }
    
    @AfterMethod
    public void getResult(ITestResult result) throws Exception
    {
        if (result.getStatus() == ITestResult.FAILURE)
        {
            String screenShotPath = GetFullPageScreenShot.capture(driver, &quot;MyFullPageScreenshot&quot;);
            test.log(Status.FAIL, MarkupHelper.createLabel(result.getName()+&quot; Test case FAILED due to below issues:&quot;, ExtentColor.RED));
            test.fail(result.getThrowable());
            test.fail(&quot;Snapshot below: &quot; + test.addScreenCaptureFromPath(screenShotPath));
        }
        else if(result.getStatus() == ITestResult.SUCCESS)
        {
            test.log(Status.PASS, MarkupHelper.createLabel(result.getName()+&quot; Test Case PASSED&quot;, ExtentColor.GREEN));
        }
        else
        {
            test.log(Status.SKIP, MarkupHelper.createLabel(result.getName()+&quot; Test Case SKIPPED&quot;, ExtentColor.ORANGE));
            test.skip(result.getThrowable());
        }
        extent.flush();
    }
    
    @AfterTest
    public void endReport()
    {
        driver.quit();
    }
}
</pre>
<p>In the above program we have written  test.log method to log the screenshot into the extent reports. This information will logged in the report with time stamp.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><span style="font-weight: 400;">In the above program we have written  test.log method to log the screenshot into the extent reports. This information will logged in the report with time stamp. </span><b>addScreenCaptureFromPath()</b><span style="font-weight: 400;"> is a method to place the screenshot in the extent report.</span></p>
<p><span style="font-weight: 400;">Below is the program to capture the full page screenshot and it will place the screenshot in a particular folder and will return the path of the screenshot. Will use that path to capture the full page screenshot in the HTML report for a failure step.</span></p>
<pre class="brush: java; highlight: [13,14,15,16]; title: ; notranslate">
import org.openqa.selenium.WebDriver;
import ru.yandex.qatools.ashot.AShot;
import ru.yandex.qatools.ashot.Screenshot;
import ru.yandex.qatools.ashot.shooting.ShootingStrategies;

import javax.imageio.ImageIO;
import java.io.File;

public class GetFullPageScreenShot
{
    public static String capture(WebDriver driver, String screenShotName) throws Exception
    {
        Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver);
        String dest = System.getProperty(&quot;user.dir&quot;) + &quot;/ErrorScreenshots/&quot; + screenShotName + &quot;.png&quot;;
        ImageIO.write(screenshot.getImage(),&quot;PNG&quot;,new File(dest));
        return dest;
    }
}
</pre>
<p>Above program will return the path of the screenshot.</p>
<p><strong>Below is the output of the above program:</strong></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2017/02/FullPage-Screenshot-in-the-Report.png"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-1401" src="https://automationtesting.in/wp-content/uploads/2017/02/FullPage-Screenshot-in-the-Report.png" alt="FullPage Screenshot in the Report" width="1365" height="668" srcset="https://automationtesting.in/wp-content/uploads/2017/02/FullPage-Screenshot-in-the-Report.png 1365w, https://automationtesting.in/wp-content/uploads/2017/02/FullPage-Screenshot-in-the-Report-300x147.png 300w, https://automationtesting.in/wp-content/uploads/2017/02/FullPage-Screenshot-in-the-Report-768x376.png 768w, https://automationtesting.in/wp-content/uploads/2017/02/FullPage-Screenshot-in-the-Report-1024x501.png 1024w" sizes="(max-width: 1365px) 100vw, 1365px" /></a></p>
<p>&nbsp;</p>
<p>Please watch the YouTube video of this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1400" data-postid="1400" class="themify_builder_content themify_builder_content-1400 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/capture-fullpage-screenshot-in-extent-reports-java/">Capture FullPage Screenshot in Extent Reports &#8211; Java</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/capture-fullpage-screenshot-in-extent-reports-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Capture Screenshot in Extent Reports &#8211; Java &#8211; Version3</title>
		<link>https://automationtesting.in/capture-screenshot-in-extent-reports-java-version3/</link>
					<comments>https://automationtesting.in/capture-screenshot-in-extent-reports-java-version3/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Thu, 23 Feb 2017 02:22:39 +0000</pubDate>
				<category><![CDATA[Extent Reports-Java-Version3]]></category>
		<category><![CDATA[capture screenshot in extent reports]]></category>
		<category><![CDATA[capture screenshot in selenium]]></category>
		<category><![CDATA[extent reports screenshot]]></category>
		<category><![CDATA[how to get screenshot in selenium]]></category>
		<category><![CDATA[report screenshot]]></category>
		<category><![CDATA[screenshot in extent reports]]></category>
		<category><![CDATA[screenshot in html report]]></category>
		<category><![CDATA[screenshot in report]]></category>
		<category><![CDATA[selenium reports]]></category>
		<category><![CDATA[selenium screenshot]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1374</guid>

					<description><![CDATA[<p>Capture Screenshot in Extent Reports will discuss about capturing the screenshot of a particular failure step in the HTML report.  In our previous blog we have seen how to log the messages in the report. Same way here we will capture the screenshot for a particular failure step. The screenshot will give the information about [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/capture-screenshot-in-extent-reports-java-version3/">Capture Screenshot in Extent Reports &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/02/CAPTURE-SCREENSHOTS-IN-EXTENT-REPORTS-JAVA-V3.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Capture Screenshot in Extent Reports will discuss about capturing the screenshot of a particular failure step in the HTML report.  In our previous blog we have seen how to log the messages in the report. Same way here we will capture the screenshot for a particular failure step. The screenshot will give the information about on which screen the script  got failed during the execution. Then we can easily identify the issue by looking into the report.</p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/XDG2V-gvSTI?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p>For this we need to use the <strong>log()</strong> method of ExtentTest class. To log the screenshot in the report we need to pass the path of the screenshot to the log method as a parameter. So, before logging the screenshot to the report we need to capture the screenshot of that particular failure method and place it in a folder from there we need to get the path of the screenshot file and pass it to the log method.</p>
<p><strong>Below is the sample program to capture screenshot in the report:</strong></p>
<pre class="brush: java; highlight: [21,22,23,29,30,31,50,51,52,53,57,61,62,64]; title: ; notranslate">
import java.io.IOException;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;

public class CapturingScreenshot
{
    ExtentHtmlReporter htmlReporter;
    ExtentReports extent;
    ExtentTest test;
    WebDriver driver;
    
    @BeforeTest
    public void config()
    {
        htmlReporter = new ExtentHtmlReporter(System.getProperty(&quot;user.dir&quot;) +&quot;/test-output/MyOwnReport.html&quot;);
        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
    }
    
    @Test
    public void captureScreenshot()
    {
        test = extent.createTest(&quot;captureScreenshot&quot;);
        System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;/KRISHNA VOLUME/drivers/geckodriver&quot;);
        driver = new FirefoxDriver();
        driver.get(&quot;https://automationtesting.in&quot;);
        String title = driver.getTitle();
        Assert.assertEquals(&quot;Home - Automation Test&quot;, title);
        }
    
    @AfterMethod
    public void getResult(ITestResult result) throws IOException
    {
        if (result.getStatus() == ITestResult.FAILURE)
        {
            String screenShotPath = GetScreenShot.capture(driver, &quot;screenShotName&quot;);
            test.log(Status.FAIL, MarkupHelper.createLabel(result.getName()+&quot; Test case FAILED due to below issues:&quot;, ExtentColor.RED));
            test.fail(result.getThrowable());
            test.fail(&quot;Snapshot below: &quot; + test.addScreenCaptureFromPath(screenShotPath));
        }
        else if(result.getStatus() == ITestResult.SUCCESS)
        {
            test.log(Status.PASS, MarkupHelper.createLabel(result.getName()+&quot; Test Case PASSED&quot;, ExtentColor.GREEN));
        }
        else
        {
            test.log(Status.SKIP, MarkupHelper.createLabel(result.getName()+&quot; Test Case SKIPPED&quot;, ExtentColor.ORANGE));
            test.skip(result.getThrowable());
        }
        extent.flush();
    }
    
    @AfterTest
    public void endReport()
    {
        driver.quit();
    }
}
</pre>
<p>In the above program we have written  test.log method to log the screenshot into the extent reports. This information will logged in the report with time stamp.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Below is the program to capture the screenshot and it will place the screenshot in a particular folder and will return the path of the screenshot. Will use that path to capture the screenshot in the HTML report for a failure step.</p>
<pre class="brush: java; highlight: [14,18]; title: ; notranslate">
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;

public class GetScreenShot {
    
    public static String capture(WebDriver driver,String screenShotName) throws IOException
    {
        TakesScreenshot ts = (TakesScreenshot)driver;
        File source = ts.getScreenshotAs(OutputType.FILE);
        String dest = System.getProperty(&quot;user.dir&quot;) +&quot;\ErrorScreenshots\&quot;+screenShotName+&quot;.png&quot;;
        File destination = new File(dest);
        FileUtils.copyFile(source, destination);        
                    
        return dest;
    }
}
</pre>
<p>Above program will return the path of the screenshot.</p>
<p><strong>Below is the output of the above program:</strong></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2017/02/Screenshot-in-the-Report.png"><img decoding="async" loading="lazy" class="alignnone wp-image-1375 size-full" src="https://automationtesting.in/wp-content/uploads/2017/02/Screenshot-in-the-Report.png" alt="Capture Screenshot in the Report" width="1365" height="668" srcset="https://automationtesting.in/wp-content/uploads/2017/02/Screenshot-in-the-Report.png 1365w, https://automationtesting.in/wp-content/uploads/2017/02/Screenshot-in-the-Report-300x147.png 300w, https://automationtesting.in/wp-content/uploads/2017/02/Screenshot-in-the-Report-768x376.png 768w, https://automationtesting.in/wp-content/uploads/2017/02/Screenshot-in-the-Report-1024x501.png 1024w" sizes="(max-width: 1365px) 100vw, 1365px" /></a></p>
<p>&nbsp;</p>
<p>Please watch the YouTube video of this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1374" data-postid="1374" class="themify_builder_content themify_builder_content-1374 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/capture-screenshot-in-extent-reports-java-version3/">Capture Screenshot in Extent Reports &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/capture-screenshot-in-extent-reports-java-version3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Extent Reports Log Generation &#8211; Java &#8211; Version3</title>
		<link>https://automationtesting.in/extent-reports-log-generation-java-version3/</link>
					<comments>https://automationtesting.in/extent-reports-log-generation-java-version3/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Thu, 23 Feb 2017 02:21:55 +0000</pubDate>
				<category><![CDATA[Extent Reports-Java-Version3]]></category>
		<category><![CDATA[advanced reports]]></category>
		<category><![CDATA[advanced selenium reports]]></category>
		<category><![CDATA[create extent reports]]></category>
		<category><![CDATA[extent reports]]></category>
		<category><![CDATA[generating extent report logs]]></category>
		<category><![CDATA[generating logs in selenium]]></category>
		<category><![CDATA[how to create extent report logs]]></category>
		<category><![CDATA[how to generate extent report log]]></category>
		<category><![CDATA[how to generate html logs]]></category>
		<category><![CDATA[HTML Reports]]></category>
		<category><![CDATA[log generation]]></category>
		<category><![CDATA[log generation in selenium]]></category>
		<category><![CDATA[pie chart]]></category>
		<category><![CDATA[Reports]]></category>
		<category><![CDATA[rich html reports]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium reports]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1361</guid>

					<description><![CDATA[<p>Extent Reports Log Generation will discuss about how to generate log steps in the Extent Reports. While running the test suite user want to log some information about the execution in the report. This information will help the user to understand the test step execution flow and any failures during the test suite execution. By [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/extent-reports-log-generation-java-version3/">Extent Reports Log Generation &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/02/EXTENT-REPORTS-LOG-GENERATION-JAVA-V3.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">Extent Reports Log Generation will discuss about how to generate log steps in the Extent Reports. While running the test suite user want to log some information about the execution in the report. This information will help the user to understand the test step execution flow and any failures during the test suite execution. </span></p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/jXyoBqANFFw?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p><span style="font-weight: 400;">By using Extent Reports we can generate logs in the HTML report. For this we need use the </span><b>log()</b><span style="font-weight: 400;"> method of the </span><b>ExtentTest</b><span style="font-weight: 400;"> Class.</span> <span style="font-weight: 400;">By using this method not only log the step information, we can provide the PASS, FAIL and SKIP information of the particular test case. To log the information we need to use the </span><b>Status.INFO</b><span style="font-weight: 400;"> as first parameter in the log() method. And we need to use </span><b>Status.PASS</b><span style="font-weight: 400;"> for the passed test case and </span><b>Status.FAIL</b><span style="font-weight: 400;"> for the failed test cases. </span></p>
<p><span style="font-weight: 400;">Not only log the information in the report as plain text, along with this we can also apply some backgrounds to that information using Label concept in the extent reports. By using this we can apply different colours to the log information.</span></p>
<p><strong>Below is the sample program for generating step logs in the report:</strong></p>
<pre class="brush: java; highlight: [14,15,16,21,22,23,29,30,31,32,35,36,37,38,39,45]; title: ; notranslate">
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;

public class CreatingLogs
{
    ExtentHtmlReporter htmlReporter;
    ExtentReports extent;
    ExtentTest test;
    
    @BeforeTest
    public void config()
    {
        htmlReporter = new ExtentHtmlReporter(System.getProperty(&quot;user.dir&quot;) +&quot;/test-output/MyOwnReport.html&quot;);
        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
    }
    
    @Test
    public void logsGeneration()
    {
        test = extent.createTest(&quot;logsGeneration&quot;);
        test.log(Status.INFO,&quot;createTest() method will return the ExtentTest object&quot;);
        test.log(Status.INFO, &quot;I am in actual Test&quot;);
        test.log(Status.INFO, &quot;We can write the actual test logic in this Test&quot;);
        
        // Using Labels
        test.log(Status.INFO, MarkupHelper.createLabel(&quot;*************** Using Labels ***************&quot;, ExtentColor.RED));
        test.log(Status.INFO, MarkupHelper.createLabel(&quot;This is Test Logger 1&quot;, ExtentColor.BLUE));
        test.log(Status.INFO, MarkupHelper.createLabel(&quot;This is Test Logger 2&quot;, ExtentColor.BLUE));
        test.log(Status.INFO, MarkupHelper.createLabel(&quot;This is Test Logger 3&quot;, ExtentColor.BLUE));
        test.log(Status.INFO, MarkupHelper.createLabel(&quot;This is Test Logger 4&quot;, ExtentColor.BLUE));
    }
    
    @AfterTest
    public void tearDown()
    {
        extent.flush();
    }
}

</pre>
<p>In the above program we have written so many <strong>test.log</strong> methods to log the information into the extent reports. This information will logged in the report with time stamp.</p>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Below is the output/report of the above program.</strong></p>
<p>&nbsp;</p>
<p><a href="https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-Logs.png"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-1369" src="https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-Logs.png" alt="Extent Report Logs" width="1346" height="646" srcset="https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-Logs.png 1346w, https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-Logs-300x144.png 300w, https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-Logs-768x369.png 768w, https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-Logs-1024x491.png 1024w" sizes="(max-width: 1346px) 100vw, 1346px" /></a></p>
<p>Please watch the YouTube video of this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1361" data-postid="1361" class="themify_builder_content themify_builder_content-1361 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/extent-reports-log-generation-java-version3/">Extent Reports Log Generation &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/extent-reports-log-generation-java-version3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Generating Extent Reports &#8211; Java &#8211; Version3</title>
		<link>https://automationtesting.in/generating-extent-reports-java-version3/</link>
					<comments>https://automationtesting.in/generating-extent-reports-java-version3/#comments</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Wed, 22 Feb 2017 14:19:27 +0000</pubDate>
				<category><![CDATA[Extent Reports-Java-Version3]]></category>
		<category><![CDATA[advanced reports]]></category>
		<category><![CDATA[advanced selenium reports]]></category>
		<category><![CDATA[create extent reports]]></category>
		<category><![CDATA[extent reports]]></category>
		<category><![CDATA[generating extent reports]]></category>
		<category><![CDATA[how to create extent reports]]></category>
		<category><![CDATA[how to generate extent reports]]></category>
		<category><![CDATA[HTML Reports]]></category>
		<category><![CDATA[pie chart]]></category>
		<category><![CDATA[Reports]]></category>
		<category><![CDATA[rich html reports]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium reports]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[Webdriver]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1354</guid>

					<description><![CDATA[<p>Extent reports are very rich HTML reports for the selenium webdriver. This report will give so much of information about the execution status. The extra information can be provided using some of the methods provided by the extent reports classes. We can provide below information to be displayed in the HTML report: Report Title Report [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/generating-extent-reports-java-version3/">Generating Extent Reports &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/02/GENERATING-EXTENT-REPORTS-JAVA-V3.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">Extent reports are very rich HTML reports for the selenium webdriver. This report will give so much of information about the execution status. The extra information can be provided using some of the methods provided by the extent reports classes. </span></p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/PllqWt4Vq7Y?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p><span style="font-weight: 400;">We can provide below information to be displayed in the HTML report:</span></p>
<ol>
<li style="font-weight: 400;"><span style="font-weight: 400;">Report Title</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Report Name</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">PIE Chart Visibility</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">PIE Chart Location</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Document Theme</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Operating System Name</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Hostname</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Environment Name</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">User Name etc&#8230;</span></li>
</ol>
<p><b>Below is the sample program:</b></p>
<pre class="brush: java; highlight: [20,21,22,27,28,29,31,32,33,34,36,37,38,39,40,46,53,60,69,70,74,78,79,86]; title: ; notranslate">
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.SkipException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.ChartLocation;
import com.aventstack.extentreports.reporter.configuration.Theme;

public class GenerateExtentReport
{
    ExtentHtmlReporter htmlReporter;
    ExtentReports extent;
    ExtentTest test;
        
    @BeforeTest
    public void startReport()
    {
        htmlReporter = new ExtentHtmlReporter(System.getProperty(&quot;user.dir&quot;) +&quot;/test-output/MyOwnReport.html&quot;);
        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
        
        extent.setSystemInfo(&quot;OS&quot;, &quot;Mac Sierra&quot;);
        extent.setSystemInfo(&quot;Host Name&quot;, &quot;Krishna&quot;);
        extent.setSystemInfo(&quot;Environment&quot;, &quot;QA&quot;);
        extent.setSystemInfo(&quot;User Name&quot;, &quot;Krishna Sakinala&quot;);
        
        htmlReporter.config().setChartVisibilityOnOpen(true);
        htmlReporter.config().setDocumentTitle(&quot;AutomationTesting.in Demo Report&quot;);
        htmlReporter.config().setReportName(&quot;My Own Report&quot;);
        htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
        htmlReporter.config().setTheme(Theme.DARK);
    }
    
    @Test
    public void demoTestPass()
    {
        test = extent.createTest(&quot;demoTestPass&quot;, &quot;This test will demonstrate the PASS test case&quot;);
        Assert.assertTrue(true);
    }
    
    @Test
    public void demoTestFail()
    {
        test = extent.createTest(&quot;demoTestFail&quot;, &quot;This test will demonstrate the FAIL test case&quot;);
        Assert.assertTrue(false);
    }
    
    @Test
    public void demoTestSkip()
    {
        test = extent.createTest(&quot;demoTestSkip&quot;, &quot;This test will demonstrate the SKIP test case&quot;);
        throw new SkipException(&quot;This test case not ready for execution&quot;);
    }
    
    @AfterMethod
    public void getResult(ITestResult result)
    {
        if(result.getStatus() == ITestResult.FAILURE)
        {
            test.log(Status.FAIL, MarkupHelper.createLabel(result.getName()+&quot; Test case FAILED due to below issues:&quot;, ExtentColor.RED));
            test.fail(result.getThrowable());
        }
        else if(result.getStatus() == ITestResult.SUCCESS)
        {
            test.log(Status.PASS, MarkupHelper.createLabel(result.getName()+&quot; Test Case PASSED&quot;, ExtentColor.GREEN));
        }
        else
        {
            test.log(Status.SKIP, MarkupHelper.createLabel(result.getName()+&quot; Test Case SKIPPED&quot;, ExtentColor.ORANGE));
            test.skip(result.getThrowable());
        }
    }
    
    @AfterTest
    public void tearDown()
    {
        extent.flush();
    }
}
</pre>
<p><span style="font-weight: 400;">In the above program, we have used three classes called </span><b>ExtentHtmlReporter</b><span style="font-weight: 400;">, </span><b>ExtentReports</b><span style="font-weight: 400;"> and </span><b>ExtentTest</b><span style="font-weight: 400;">. These three classes will help us to create a rich HTML reports with lot of useful information. ExtentHtmlReporter will take the HTML report file path as an argument and it will create the report file with the mentioned name in the mentioned location. By using this we can set lot of configuration to the report. ExtentReports will be used to set the system/custom information in the generated HTML report. And ExtentTest</span> <span style="font-weight: 400;">will be used to log the so much information to the report like PASS, FAIL  and SKIP status of the executed tests. Along with this we can generate logs in the generated HTML report.</span></p>
<p><b>Important points to be remember:</b></p>
<ol>
<li style="font-weight: 400;"><span style="font-weight: 400;">ExtentHtmlReporter</span> <span style="font-weight: 400;">will create the report file and set the configuration to the report.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">ExtentReports will set the system/custom information to the report.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">ExtentTest will log the information in the report.</span></li>
<li style="font-weight: 400;"><b>createTest</b><b>()</b><span style="font-weight: 400;"> method of ExtentReports class is the starting point of the test and it will return the ExtentTest object.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">We need to capture that object into ExtentTest object.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Used this reference to log the information into the report.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">ExtentHtmlReporter object will be used to add the report information like Title, Header and Theme etc..</span></li>
<li style="font-weight: 400;"><b>flush()</b><span style="font-weight: 400;"> method of ExtentReports will push/write everything to the document.</span></li>
</ol>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 800*100 --><br />
<ins class="adsbygoogle" style="display: inline-block; width: 800px; height: 100px;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="9211570346"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<b></b></p>
<p><b>Output of the above program is:</b></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2017/02/1.png"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-1355" src="https://automationtesting.in/wp-content/uploads/2017/02/1.png" alt="Sample Extent Report - 1" width="1920" height="1088" srcset="https://automationtesting.in/wp-content/uploads/2017/02/1.png 1920w, https://automationtesting.in/wp-content/uploads/2017/02/1-300x170.png 300w, https://automationtesting.in/wp-content/uploads/2017/02/1-768x435.png 768w, https://automationtesting.in/wp-content/uploads/2017/02/1-1024x580.png 1024w" sizes="(max-width: 1920px) 100vw, 1920px" /></a> <a href="https://automationtesting.in/wp-content/uploads/2017/02/2.png"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-1356" src="https://automationtesting.in/wp-content/uploads/2017/02/2.png" alt="Sample Extent Report - 2" width="1904" height="1001" srcset="https://automationtesting.in/wp-content/uploads/2017/02/2.png 1904w, https://automationtesting.in/wp-content/uploads/2017/02/2-300x158.png 300w, https://automationtesting.in/wp-content/uploads/2017/02/2-768x404.png 768w, https://automationtesting.in/wp-content/uploads/2017/02/2-1024x538.png 1024w" sizes="(max-width: 1904px) 100vw, 1904px" /></a></p>
<p><span style="font-weight: 400;">Please watch the YouTube video of this blog for better understanding.</span><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1354" data-postid="1354" class="themify_builder_content themify_builder_content-1354 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/generating-extent-reports-java-version3/">Generating Extent Reports &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/generating-extent-reports-java-version3/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Extent Reports Introduction &#8211; Java &#8211; Version3</title>
		<link>https://automationtesting.in/extent-reports-introduction-java-version3/</link>
					<comments>https://automationtesting.in/extent-reports-introduction-java-version3/#comments</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Wed, 22 Feb 2017 10:32:27 +0000</pubDate>
				<category><![CDATA[Extent Reports-Java-Version3]]></category>
		<category><![CDATA[advanced reports]]></category>
		<category><![CDATA[advanced selenium reports]]></category>
		<category><![CDATA[create extent reports]]></category>
		<category><![CDATA[extent reports]]></category>
		<category><![CDATA[generating extent reports]]></category>
		<category><![CDATA[how to create extent reports]]></category>
		<category><![CDATA[how to generate extent reports]]></category>
		<category><![CDATA[HTML Reports]]></category>
		<category><![CDATA[pie chart]]></category>
		<category><![CDATA[Reports]]></category>
		<category><![CDATA[rich html reports]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium reports]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[Webdriver]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1343</guid>

					<description><![CDATA[<p>In software test automation after completion of the test suite execution we need to have a report for the execution status and it is the only way of evidence for the pass and fail status of the tests. And most of the clients bother about the detailed report of the execution status. Most of the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/extent-reports-introduction-java-version3/">Extent Reports Introduction &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/02/EXTENT-REPORTS-INTRODUCTION-JAVA-V3.png'></p><p>In software test automation after completion of the test suite execution we need to have a report for the execution status and it is the only way of evidence for the pass and fail status of the tests. And most of the clients bother about the detailed report of the execution status. Most of the licensed automation testing tools will have in built rich report option to show the execution status. But coming to open source automation tools lacking in this option. Same way, Selenium also does not have the automation report generation option. But to execute the test suite, selenium is depending on unit testing frameworks like TestNG and Junit.</p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/l3-FN67blxI?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p>After test suite execution using TestNG or Junit, by default they will give the HTML reports, but the information provided by these reports are not so good. To avoid this, we are using XSLT reports, these are much better than normal TestNG and Junit reports.These will give a pie chart to represent the PASS,FAIL and SKIP test cases. Apart from this PIE Chart it will not give anymore information in the generated HTML report. If we want any other information we need to write separate code. And configuring XSLT reports also bit tedious process. For this, we need to install and configure the ant in the machine and follow certain procedure to generate these reports.</p>
<p><strong>TestNG Default Report:</strong></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2016/12/defaultTestNG.png"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-153" src="https://automationtesting.in/wp-content/uploads/2016/12/defaultTestNG.png" alt="Default TestNG Report" width="1910" height="570" srcset="https://automationtesting.in/wp-content/uploads/2016/12/defaultTestNG.png 1910w, https://automationtesting.in/wp-content/uploads/2016/12/defaultTestNG-300x90.png 300w, https://automationtesting.in/wp-content/uploads/2016/12/defaultTestNG-768x229.png 768w, https://automationtesting.in/wp-content/uploads/2016/12/defaultTestNG-1024x306.png 1024w" sizes="(max-width: 1910px) 100vw, 1910px" /></a></p>
<p><strong>XSLT Report:</strong></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2016/12/xslt.png"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-155" src="https://automationtesting.in/wp-content/uploads/2016/12/xslt.png" alt="XSLT Report" width="1907" height="398" srcset="https://automationtesting.in/wp-content/uploads/2016/12/xslt.png 1907w, https://automationtesting.in/wp-content/uploads/2016/12/xslt-300x63.png 300w, https://automationtesting.in/wp-content/uploads/2016/12/xslt-768x160.png 768w, https://automationtesting.in/wp-content/uploads/2016/12/xslt-1024x214.png 1024w" sizes="(max-width: 1907px) 100vw, 1907px" /></a></p>
<p>To overcome these type of issues, we can use Extent Reports. These are very good and rich HTML reports. By using these reports we can provide lot information to the reports. These will also give the status in the form of PIE Chart. We have two variants of extent reports one is Community version and the other is paid version. But most of the things can be achieved using community version.</p>
<p><strong>Below are the advantages provided by the Extent Reports:</strong></p>
<ol>
<li>Status will be shown in the form of PIE chart.</li>
<li>Can replace the existing report with the new report or append the new status to the existing report.</li>
<li>We can change display order of the tests(i.e. oldest test at the top, newest at the end or newest test at the top, oldest at the end)</li>
<li>Can generate ONLINE or OFFLINE reports.</li>
<li>Can give the our own name to the test method (i.e can change the test method name in the report).</li>
<li>Can generate stepwise log information in the report.</li>
<li>Can segregate the tests using Test Categories.</li>
<li>Can give test author name to display in the report.</li>
<li>Can add a test node as a child of another test.</li>
<li>Can insert any custom HTML in the logs by using an HTML tag.</li>
<li>Can show the screenshots in the report wherever we need.</li>
<li>Can add recording of your test runs in the report.</li>
<li>Can add our own information in the report (i.e. version of selenium used, Environment information where the test suite executed).</li>
<li>Can give our own name to the HTML report.</li>
<li>You can give the System information in the report (i.e. HostName and OS used to execute the test suite.)</li>
</ol>
<p>The above are the advantages provided by the extent reports. We can discuss all these things in the coming blogs.</p>
<p><strong>Extent Report:</strong></p>
<p><a href="https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-V3.gif"><img decoding="async" loading="lazy" class="alignnone size-full wp-image-1347" src="https://automationtesting.in/wp-content/uploads/2017/02/Extent-Report-V3.gif" alt="Extent Report" width="1350" height="645" /></a></p>
<p><span style="font-weight: 400;">You can find the complete information in the below link:</span></p>
<p><a href="http://extentreports.com/docs/versions/3/java/">http://extentreports.com/docs/versions/3/java/</a></p>
<p><span style="font-weight: 400;">You can download the Extent Reports Jars in this link:</span></p>
<p><a href="http://extentreports.com/community/">http://extentreports.com/community/</a></p>
<p>Last but not least, a big thanks to Anshoo Arora for giving this type of reports.</p>
<p>Please watch the YouTube video of this blog for better understanding.</p>
<div id="themify_builder_content-1343" data-postid="1343" class="themify_builder_content themify_builder_content-1343 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/extent-reports-introduction-java-version3/">Extent Reports Introduction &#8211; Java &#8211; Version3</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/extent-reports-introduction-java-version3/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
