renamed back to testing-modules, pulled together testing-modules-2 modules into single module
This commit is contained in:
5
testing-modules/testng/README.md
Normal file
5
testing-modules/testng/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
### Relevant articles
|
||||
|
||||
- [Introduction to TestNG](http://www.baeldung.com/testng)
|
||||
- [Custom Reporting with TestNG](http://www.baeldung.com/testng-custom-reporting)
|
||||
- [A Quick JUnit vs TestNG Comparison](https://www.baeldung.com/junit-vs-testng)
|
||||
48
testing-modules/testng/pom.xml
Normal file
48
testing-modules/testng/pom.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<name>testng</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- test scoped -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>${testng.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>testng</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</testResource>
|
||||
</testResources>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<!-- testing -->
|
||||
<testng.version>6.10</testng.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class DependentLongRunningUnitTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DependentLongRunningUnitTest.class);
|
||||
|
||||
private String email = "abc@qwe.com";
|
||||
|
||||
@Test
|
||||
public void givenEmail_ifValid_thenTrue() {
|
||||
boolean valid = email.contains("@");
|
||||
Assert.assertEquals(valid, true);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = {"givenEmail_ifValid_thenTrue"})
|
||||
public void givenValidEmail_whenLoggedIn_thenTrue() {
|
||||
LOGGER.info("Email {} valid >> logging in", email);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GroupIntegrationTest {
|
||||
|
||||
@BeforeGroups("database")
|
||||
public void setupDB() {
|
||||
System.out.println("setupDB()");
|
||||
}
|
||||
|
||||
@AfterGroups("database")
|
||||
public void cleanDB() {
|
||||
System.out.println("cleanDB()");
|
||||
}
|
||||
|
||||
@Test(groups = "selenium-test")
|
||||
public void runSelenium() {
|
||||
System.out.println("runSelenium()");
|
||||
}
|
||||
|
||||
@Test(groups = "selenium-test")
|
||||
public void runSelenium1() {
|
||||
System.out.println("runSelenium()1");
|
||||
}
|
||||
|
||||
@Test(groups = "database")
|
||||
public void testConnectOracle() {
|
||||
System.out.println("testConnectOracle()");
|
||||
}
|
||||
|
||||
@Test(groups = "database")
|
||||
public void testConnectMsSQL() {
|
||||
System.out.println("testConnectMsSQL");
|
||||
}
|
||||
|
||||
@Test(dependsOnGroups = {"database", "selenium-test"})
|
||||
public void runFinal() {
|
||||
System.out.println("runFinal");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class MultiThreadedIntegrationTest {
|
||||
|
||||
@Test(threadPoolSize = 5, invocationCount = 10, timeOut = 1000)
|
||||
public void givenMethod_whenRunInThreads_thenCorrect() {
|
||||
int count = Thread.activeCount();
|
||||
Assert.assertTrue(count > 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
public class ParametrizedLongRunningUnitTest {
|
||||
|
||||
@Test
|
||||
@Parameters({"value", "isEven"})
|
||||
public void givenNumberFromXML_ifEvenCheckOK_thenCorrect(int value, boolean isEven) {
|
||||
assertEquals(isEven, value % 2 == 0);
|
||||
}
|
||||
|
||||
@DataProvider(name = "numbers")
|
||||
public static Object[][] evenNumbers() {
|
||||
return new Object[][]{{1, false}, {2, true}, {4, true}};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "numbers")
|
||||
public void givenNumberFromDataProvider_ifEvenCheckOK_thenCorrect(Integer number, boolean expected) {
|
||||
assertEquals(expected, number % 2 == 0);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "numbersObject")
|
||||
public void givenNumberObjectFromDataProvider_ifEvenCheckOK_thenCorrect(EvenNumber number) {
|
||||
assertEquals(number.isEven(), number.getValue() % 2 == 0);
|
||||
}
|
||||
|
||||
@DataProvider(name = "numbersObject")
|
||||
public Object[][] parameterProvider() {
|
||||
return new Object[][]{{new EvenNumber(1, false)}, {new EvenNumber(2, true)}, {new EvenNumber(4, true),}};
|
||||
}
|
||||
|
||||
class EvenNumber {
|
||||
private int value;
|
||||
private boolean isEven;
|
||||
|
||||
EvenNumber(int number, boolean isEven) {
|
||||
this.value = number;
|
||||
this.isEven = isEven;
|
||||
}
|
||||
|
||||
int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
boolean isEven() {
|
||||
return isEven;
|
||||
}
|
||||
|
||||
public void setEven(boolean even) {
|
||||
isEven = even;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EvenNumber{" +
|
||||
"value=" + value +
|
||||
", isEven=" + isEven +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
public class PriorityLongRunningUnitTest {
|
||||
|
||||
@Test(priority = 1)
|
||||
public void givenString_whenChangedToInt_thenCorrect() {
|
||||
String testString = "10";
|
||||
assertTrue(Integer.valueOf(testString) instanceof Integer);
|
||||
}
|
||||
|
||||
@Test(priority = 2)
|
||||
public void givenInt_whenChangedToString_thenCorrect() {
|
||||
int testInt = 23;
|
||||
assertTrue(String.valueOf(testInt) instanceof String);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RegistrationLongRunningUnitTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrationLongRunningUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void whenCalledFromSuite_thanOK() {
|
||||
LOGGER.info("Registration successful");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SignInLongRunningUnitTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SignInLongRunningUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void whenCalledFromSuite_thanOK() {
|
||||
LOGGER.info("SignIn successful");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.TestNG;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SimpleLongRunningUnitTest extends TestNG {
|
||||
private int number;
|
||||
|
||||
@BeforeClass
|
||||
public void setup() {
|
||||
number = 12;
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void tearDown() {
|
||||
number = 0;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNumber_whenEven_thenTrue() {
|
||||
Assert.assertTrue(number % 2 == 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.TestNG;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.AfterSuite;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.BeforeSuite;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SummationServiceIntegrationTest extends TestNG {
|
||||
private List<Integer> numbers;
|
||||
|
||||
private int testCount = 0;
|
||||
|
||||
@BeforeClass
|
||||
public void initialize() {
|
||||
numbers = new ArrayList<>();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void tearDown() {
|
||||
numbers = null;
|
||||
}
|
||||
|
||||
@BeforeSuite(groups = "regression")
|
||||
public void runBeforeRegressionSuite() {
|
||||
numbers = new ArrayList<>();
|
||||
numbers.add(-11);
|
||||
numbers.add(2);
|
||||
}
|
||||
|
||||
@AfterSuite(groups = "regression")
|
||||
public void runAfterRegressionSuite() {
|
||||
numbers = null;
|
||||
}
|
||||
|
||||
@BeforeGroups("negative_tests")
|
||||
public void runBeforeEachNegativeGroup() {
|
||||
numbers.clear();
|
||||
}
|
||||
|
||||
@BeforeGroups("regression")
|
||||
public void runBeforeEachRegressionGroup() {
|
||||
numbers.add(-11);
|
||||
numbers.add(2);
|
||||
}
|
||||
|
||||
@BeforeGroups("positive_tests")
|
||||
public void runBeforeEachPositiveGroup() {
|
||||
numbers.add(1);
|
||||
numbers.add(2);
|
||||
numbers.add(3);
|
||||
}
|
||||
|
||||
@AfterGroups("positive_tests,regression,negative_tests")
|
||||
public void runAfterEachGroup() {
|
||||
numbers.clear();
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void runBeforeEachTest() {
|
||||
testCount++;
|
||||
}
|
||||
|
||||
@AfterMethod
|
||||
public void runAfterEachTest() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = "positive_tests", enabled = false)
|
||||
public void givenNumbers_sumEquals_thenCorrect() {
|
||||
int sum = numbers.stream().reduce(0, Integer::sum);
|
||||
Assert.assertEquals(sum, 6);
|
||||
}
|
||||
|
||||
@Test(groups = "negative_tests")
|
||||
public void givenEmptyList_sumEqualsZero_thenCorrect() {
|
||||
int sum = numbers.stream().reduce(0, Integer::sum);
|
||||
Assert.assertEquals(0, sum);
|
||||
}
|
||||
|
||||
@Test(groups = "regression")
|
||||
public void givenNegativeNumber_sumLessthanZero_thenCorrect() {
|
||||
int sum = numbers.stream().reduce(0, Integer::sum);
|
||||
Assert.assertTrue(sum < 0);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ArithmeticException.class)
|
||||
public void givenNumber_whenThrowsException_thenCorrect() {
|
||||
int i = 1 / 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class TimeOutIntegrationTest {
|
||||
|
||||
@Test(timeOut = 1000, enabled = false)
|
||||
public void givenExecution_takeMoreTime_thenFail() {
|
||||
while (true) ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.baeldung.reports;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.ITestListener;
|
||||
import org.testng.ITestResult;
|
||||
|
||||
public class CustomisedListener implements ITestListener {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger("CUSTOM_LOGS");
|
||||
|
||||
@Override
|
||||
public void onFinish(ITestContext context) {
|
||||
LOGGER.info("PASSED TEST CASES");
|
||||
context.getPassedTests()
|
||||
.getAllResults()
|
||||
.forEach(result -> {
|
||||
LOGGER.info(result.getName());
|
||||
});
|
||||
LOGGER.info("FAILED TEST CASES");
|
||||
context.getFailedTests()
|
||||
.getAllResults()
|
||||
.forEach(result -> {
|
||||
LOGGER.info(result.getName());
|
||||
});
|
||||
LOGGER.info("Test completed on: " + context.getEndDate()
|
||||
.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(ITestContext arg0) {
|
||||
LOGGER.info("Started testing on: " + arg0.getStartDate()
|
||||
.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestFailure(ITestResult arg0) {
|
||||
LOGGER.info("Failed : " + arg0.getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestSkipped(ITestResult arg0) {
|
||||
LOGGER.info("Skipped Test: " + arg0.getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestStart(ITestResult arg0) {
|
||||
LOGGER.info("Testing: " + arg0.getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestSuccess(ITestResult arg0) {
|
||||
long timeTaken = ((arg0.getEndMillis() - arg0.getStartMillis()));
|
||||
LOGGER.info("Tested: " + arg0.getName() + " Time taken:" + timeTaken + " ms");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.baeldung.reports;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.*;
|
||||
import org.testng.xml.XmlSuite;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
public class CustomisedReports implements IReporter {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CustomisedReports.class);
|
||||
|
||||
private static final String ROW_TEMPLATE = "<tr class=\"%s\"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>";
|
||||
|
||||
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
|
||||
String reportTemplate = initReportTemplate();
|
||||
|
||||
final String body = suites
|
||||
.stream()
|
||||
.flatMap(suiteToResults())
|
||||
.collect(Collectors.joining());
|
||||
|
||||
saveReportTemplate(outputDirectory, reportTemplate.replaceFirst("</tbody>", String.format("%s</tbody>", body)));
|
||||
}
|
||||
|
||||
private Function<ISuite, Stream<? extends String>> suiteToResults() {
|
||||
return suite -> suite.getResults().entrySet()
|
||||
.stream()
|
||||
.flatMap(resultsToRows(suite));
|
||||
}
|
||||
|
||||
private Function<Map.Entry<String, ISuiteResult>, Stream<? extends String>> resultsToRows(ISuite suite) {
|
||||
return e -> {
|
||||
ITestContext testContext = e.getValue().getTestContext();
|
||||
|
||||
Set<ITestResult> failedTests = testContext
|
||||
.getFailedTests()
|
||||
.getAllResults();
|
||||
Set<ITestResult> passedTests = testContext
|
||||
.getPassedTests()
|
||||
.getAllResults();
|
||||
Set<ITestResult> skippedTests = testContext
|
||||
.getSkippedTests()
|
||||
.getAllResults();
|
||||
|
||||
String suiteName = suite.getName();
|
||||
|
||||
return Stream
|
||||
.of(failedTests, passedTests, skippedTests)
|
||||
.flatMap(results -> generateReportRows(e.getKey(), suiteName, results).stream());
|
||||
};
|
||||
}
|
||||
|
||||
private List<String> generateReportRows(String testName, String suiteName, Set<ITestResult> allTestResults) {
|
||||
return allTestResults.stream()
|
||||
.map(testResultToResultRow(testName, suiteName))
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private Function<ITestResult, String> testResultToResultRow(String testName, String suiteName) {
|
||||
return testResult -> {
|
||||
switch (testResult.getStatus()) {
|
||||
case ITestResult.FAILURE:
|
||||
return String.format(ROW_TEMPLATE, "danger", suiteName, testName, testResult.getName(), "FAILED", "NA");
|
||||
|
||||
case ITestResult.SUCCESS:
|
||||
return String.format(ROW_TEMPLATE, "success", suiteName, testName, testResult.getName(), "PASSED", String.valueOf(testResult.getEndMillis() - testResult.getStartMillis()));
|
||||
|
||||
case ITestResult.SKIP:
|
||||
return String.format(ROW_TEMPLATE, "warning", suiteName, testName, testResult.getName(), "SKIPPED", "NA");
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private String initReportTemplate() {
|
||||
String template = null;
|
||||
byte[] reportTemplate;
|
||||
try {
|
||||
reportTemplate = Files.readAllBytes(Paths.get("src/test/resources/reportTemplate.html"));
|
||||
template = new String(reportTemplate, "UTF-8");
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Problem initializing template", e);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
private void saveReportTemplate(String outputDirectory, String reportTemplate) {
|
||||
new File(outputDirectory).mkdirs();
|
||||
try {
|
||||
PrintWriter reportWriter = new PrintWriter(new BufferedWriter(new FileWriter(new File(outputDirectory, "my-report.html"))));
|
||||
reportWriter.println(reportTemplate);
|
||||
reportWriter.flush();
|
||||
reportWriter.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Problem saving template", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
testing-modules/testng/src/test/resources/logback.xml
Normal file
19
testing-modules/testng/src/test/resources/logback.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>web - %date [%thread] %-5level %logger{36} - %message%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework" level="WARN" />
|
||||
<logger name="org.springframework.transaction" level="WARN" />
|
||||
|
||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
<suite name="My test suite">
|
||||
<listeners>
|
||||
<listener class-name="com.baeldung.reports.CustomisedListener"></listener>
|
||||
</listeners>
|
||||
<test name="numbersXML">
|
||||
<parameter name="value" value="1"/>
|
||||
<parameter name="isEven" value="false"/>
|
||||
<classes>
|
||||
<class name="com.baeldung.ParametrizedLongRunningUnitTest"/>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head><title>My Custom Report</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Suite</th>
|
||||
<th>Test</th>
|
||||
<th>Method</th>
|
||||
<th>Status</th>
|
||||
<th>Execution Time(ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="success">
|
||||
<td>My test suite</td>
|
||||
<td>numbersXML</td>
|
||||
<td>givenNumberObjectFromDataProvider_ifEvenCheckOK_thenCorrect</td>
|
||||
<td>PASSED</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
13
testing-modules/testng/src/test/resources/test_group.xml
Normal file
13
testing-modules/testng/src/test/resources/test_group.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
<suite name="regression_test">
|
||||
<test name="test groups">
|
||||
<groups>
|
||||
<run>
|
||||
<include name="regression"/>
|
||||
</run>
|
||||
</groups>
|
||||
<classes>
|
||||
<class name="com.baeldung.SummationServiceIntegrationTest"/>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
17
testing-modules/testng/src/test/resources/test_setup.xml
Normal file
17
testing-modules/testng/src/test/resources/test_setup.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
<suite name="regression_test">
|
||||
<test name="test setup">
|
||||
<groups>
|
||||
<run>
|
||||
<include name="regression"/>
|
||||
</run>
|
||||
</groups>
|
||||
<classes>
|
||||
<class name="com.baeldung.SummationServiceIntegrationTest">
|
||||
<methods>
|
||||
<include name="givenNumbers_sumEquals_thenCorrect"/>
|
||||
</methods>
|
||||
</class>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
13
testing-modules/testng/src/test/resources/test_suite.xml
Normal file
13
testing-modules/testng/src/test/resources/test_suite.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
<suite name="suite" parallel="classes" thread-count="2">
|
||||
<listeners>
|
||||
<listener class-name="com.baeldung.reports.CustomisedReports" />
|
||||
</listeners>
|
||||
<test name="test suite">
|
||||
<classes>
|
||||
<class name="com.baeldung.RegistrationLongRunningUnitTest" />
|
||||
<class name="com.baeldung.SignInLongRunningUnitTest" />
|
||||
<class name="com.baeldung.SimpleLongRunningUnitTest" />
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
Reference in New Issue
Block a user