Creating Awesome Reporting for Selenium Test Automation Framework with ATU reporting.
Kushan Shalindra Amarasiri
Director Quality Engineering at Social Catfish
We have looked at many of reporting add-ons that we can use for our Java based test automation framework which uses any of the Java based test automation tools like Selenium, Selenide, Protractor and even REST Assured.
ATU reporting is also a fantastic reporting framework that I came across, while carrying out research on test automation reporting. It is based on TestNG and there is no server side technology like Vigo reporting which we studied recently. We can create an interactive and graphical report like the following image with the use of ATU reporting.
First download the required .jar file from the following site
Next place them into a folder you desire and then add the following .jar file to your automation project
Now lets create a simple Selenium WebDriver navigation test scenario as follows;
package Pck;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import atu.testng.reports.ATUReports;
import atu.testng.reports.listeners.ATUReportsListener;
import atu.testng.reports.listeners.ConfigurationListener;
import atu.testng.reports.listeners.MethodListener;
import atu.testng.reports.logging.LogAs;
import atu.testng.selenium.reports.CaptureScreen;
import atu.testng.selenium.reports.CaptureScreen.ScreenshotOf;
@Listeners({ ATUReportsListener.class, ConfigurationListener.class,
MethodListener.class })
public class TestCase {
@Test
public void testMethod() throws InterruptedException
{
System.setProperty("atu.reporter.config", "C:/Tools/atu/");
ATUReports.indexPageDescription = "Test Kushan Report";
//Adds the title to index page
WebDriver driver = new ChromeDriver();
ATUReports.setWebDriver(driver);
//Starts rendering the report
driver.get("https://www.google.lk");
ATUReports.add("Navigated to Google", LogAs.INFO, new CaptureScreen(ScreenshotOf.BROWSER_PAGE));
//Adds a info step in the ATU report
driver.findElement(By.id("lst-ib")).sendKeys("Sri Lanka");
ATUReports.add("Search word Sri Lanka was typed", LogAs.INFO, new CaptureScreen(ScreenshotOf.BROWSER_PAGE));
Thread.sleep(5000);
driver.findElement(By.className("lsb")).click();
ATUReports.add("Clicked on Search Button", LogAs.INFO, new CaptureScreen(ScreenshotOf.BROWSER_PAGE));
driver.findElement(By.linkText("Sri Lanka - Wikipedia")).click();
ATUReports.add("Clicked on Link Sri Lanka Wikipedia", LogAs.INFO, new CaptureScreen(ScreenshotOf.BROWSER_PAGE));
driver.close();
}
}
Now execute the TestNG automation scenario and you will see that your report is being created in the Project Explorer.
Click on the index.html file and you can navigate to the wonderful ATU report which was created by our test run.
Looking at other reporting mechanisms ATU report is created as a standalone html file and there is no dashboard involved. Therefore the report should be compressed and sent via email. Unlike Vigo reports there is no automatic triggering of emails. ATU reporting as good graphical and interactive features, but its a bit primitive compared to other reporting mechanisms.
Director Quality Engineering at Social Catfish
6 年Please add the .jars for ATU Reporting and also please debug ur code then you can find why null pointer exception is coming