Quality is delighting customers
I need the following selenium webdriver scripts:
1. Custom Reporting - Report should generate after end of the execution
2. Email Report - Send custom report through email
Tags:
Use jenkins integration tool
Hi Ajveer,
If you don't mind please share steps, How to use jenkins plugin?
https://wiki.jenkins-ci.org/display/JENKINS/Home
I'll explain tommorrow step by step.
CustomResult.java
import java.util.List;
import java.util.Map;
import org.testng.IReporter;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.ITestContext;
import org.testng.xml.XmlSuite;
public class CustomReporter implements IReporter{
@Override
public void generateReport(List xmlSuites, List suites,
String outputDirectory) {
for (ISuite suite : suites) {
String suiteName = suite.getName();
Map suiteResults = suite.getResults();
for (ISuiteResult sr : suiteResults.values()) {
ITestContext tc = sr.getTestContext();
System.out.println("Passed tests for suite '" + suiteName +
"' is:" + tc.getPassedTests().getAllResults().size());
System.out.println("Failed tests for suite '" + suiteName +
"' is:" +
tc.getFailedTests().getAllResults().size());
System.out.println("Skipped tests for suite '" + suiteName +
"' is:" +
tc.getSkippedTests().getAllResults().size());
}
}
}
Class Test.java
import org.testng.Assert;
import org.testng.annotations.Test;
public class SampleTest {
@Test
public void testMethodOne(){
Assert.assertTrue(true);
}
@Test
public void testMethodTwo(){
Assert.assertTrue(false);
}
@Test(dependsOnMethods={"testMethodTwo"})
public void testMethodThree(){
Assert.assertTrue(true);
}
}
}
TestNg xml:-
<?xml version="1.0" encoding="UTF-8"?>
<suite name="Simple Reporter Suite">
<listeners>
<listener class-name="CustomReporter" />
</listeners>
<test name="Simple Reporter test">
<classes>
<class name="SampleTest" />
</classes>
</test>
</suite>
Please provide the information about your framework. As those are custom reports, one approach is to create HTML dynamically.
I am using TestNG Framework.
If you have any code please share.
refer
© 2019 Created by Quality Testing.
Powered by