Skip to content

Commit efdd452

Browse files
BAEL-701 - TestNG reformatting
1 parent 95e24da commit efdd452

5 files changed

Lines changed: 193 additions & 193 deletions

File tree

‎testng/pom.xml‎

Lines changed: 116 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,121 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<groupId>com.baeldung</groupId>
6-
<artifactId>testng</artifactId>
7-
<version>0.1.0-SNAPSHOT</version>
8-
<packaging>jar</packaging>
9-
<name>testng</name>
10-
11-
<dependencies>
12-
13-
<!-- logging -->
14-
15-
<dependency>
16-
<groupId>org.slf4j</groupId>
17-
<artifactId>slf4j-api</artifactId>
18-
<version>${org.slf4j.version}</version>
19-
</dependency>
20-
<dependency>
21-
<groupId>ch.qos.logback</groupId>
22-
<artifactId>logback-classic</artifactId>
23-
<version>${logback.version}</version>
24-
</dependency>
25-
26-
<!-- test scoped -->
27-
28-
<dependency>
29-
<groupId>org.testng</groupId>
30-
<artifactId>testng</artifactId>
31-
<version>${testng.version}</version>
32-
<scope>test</scope>
33-
</dependency>
34-
35-
</dependencies>
36-
37-
<build>
38-
<finalName>testng</finalName>
39-
<resources>
40-
<resource>
41-
<directory>src/main/resources</directory>
42-
<filtering>true</filtering>
43-
</resource>
44-
</resources>
45-
<testResources>
46-
<testResource>
47-
<directory>src/main/resources</directory>
48-
<filtering>true</filtering>
49-
</testResource>
50-
</testResources>
51-
52-
<plugins>
53-
54-
<plugin>
55-
<groupId>org.apache.maven.plugins</groupId>
56-
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>${maven-compiler-plugin.version}</version>
58-
<configuration>
59-
<source>1.8</source>
60-
<target>1.8</target>
61-
</configuration>
62-
</plugin>
63-
64-
<plugin>
65-
<groupId>org.apache.maven.plugins</groupId>
66-
<artifactId>maven-surefire-plugin</artifactId>
67-
<version>${maven-surefire-plugin.version}</version>
68-
<configuration>
69-
<excludes>
70-
<exclude>**/*IntegrationTest.java</exclude>
71-
<exclude>**/*LongRunningUnitTest.java</exclude>
72-
<exclude>**/*ManualTest.java</exclude>
73-
</excludes>
74-
<suiteXmlFiles>
75-
<suiteXmlFile>src\test\resources\parametrized_testng.xml</suiteXmlFile>
76-
<suiteXmlFile>src\test\resources\test_group.xml</suiteXmlFile>
77-
<suiteXmlFile>src\test\resources\test_setup.xml</suiteXmlFile>
78-
<suiteXmlFile>src\test\resources\test_suite.xml</suiteXmlFile>
79-
</suiteXmlFiles>
80-
81-
<testFailureIgnore>true</testFailureIgnore>
82-
</configuration>
83-
</plugin>
84-
85-
<plugin>
86-
<groupId>org.apache.maven.plugins</groupId>
87-
<artifactId>maven-dependency-plugin</artifactId>
88-
<executions>
89-
<execution>
90-
<id>copy-dependencies</id>
91-
<phase>prepare-package</phase>
92-
<goals>
93-
<goal>copy-dependencies</goal>
94-
</goals>
95-
<configuration>
96-
<outputDirectory>${project.build.directory}/libs</outputDirectory>
97-
</configuration>
98-
</execution>
99-
</executions>
100-
</plugin>
101-
</plugins>
102-
103-
</build>
104-
105-
<properties>
106-
107-
<!-- logging -->
108-
<org.slf4j.version>1.7.21</org.slf4j.version>
109-
<logback.version>1.1.7</logback.version>
110-
111-
<!-- testing -->
112-
<testng.version>6.10</testng.version>
113-
114-
<!-- maven plugins -->
115-
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
116-
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
117-
118-
</properties>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.baeldung</groupId>
6+
<artifactId>testng</artifactId>
7+
<version>0.1.0-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
<name>testng</name>
10+
11+
<dependencies>
12+
13+
<!-- logging -->
14+
15+
<dependency>
16+
<groupId>org.slf4j</groupId>
17+
<artifactId>slf4j-api</artifactId>
18+
<version>${org.slf4j.version}</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>ch.qos.logback</groupId>
22+
<artifactId>logback-classic</artifactId>
23+
<version>${logback.version}</version>
24+
</dependency>
25+
26+
<!-- test scoped -->
27+
28+
<dependency>
29+
<groupId>org.testng</groupId>
30+
<artifactId>testng</artifactId>
31+
<version>${testng.version}</version>
32+
<scope>test</scope>
33+
</dependency>
34+
35+
</dependencies>
36+
37+
<build>
38+
<finalName>testng</finalName>
39+
<resources>
40+
<resource>
41+
<directory>src/main/resources</directory>
42+
<filtering>true</filtering>
43+
</resource>
44+
</resources>
45+
<testResources>
46+
<testResource>
47+
<directory>src/main/resources</directory>
48+
<filtering>true</filtering>
49+
</testResource>
50+
</testResources>
51+
52+
<plugins>
53+
54+
<plugin>
55+
<groupId>org.apache.maven.plugins</groupId>
56+
<artifactId>maven-compiler-plugin</artifactId>
57+
<version>${maven-compiler-plugin.version}</version>
58+
<configuration>
59+
<source>1.8</source>
60+
<target>1.8</target>
61+
</configuration>
62+
</plugin>
63+
64+
<plugin>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-surefire-plugin</artifactId>
67+
<version>${maven-surefire-plugin.version}</version>
68+
<configuration>
69+
<excludes>
70+
<exclude>**/*IntegrationTest.java</exclude>
71+
<exclude>**/*LongRunningUnitTest.java</exclude>
72+
<exclude>**/*ManualTest.java</exclude>
73+
</excludes>
74+
<suiteXmlFiles>
75+
<suiteXmlFile>src\test\resources\parametrized_testng.xml</suiteXmlFile>
76+
<suiteXmlFile>src\test\resources\test_group.xml</suiteXmlFile>
77+
<suiteXmlFile>src\test\resources\test_setup.xml</suiteXmlFile>
78+
<suiteXmlFile>src\test\resources\test_suite.xml</suiteXmlFile>
79+
</suiteXmlFiles>
80+
81+
<testFailureIgnore>true</testFailureIgnore>
82+
</configuration>
83+
</plugin>
84+
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-dependency-plugin</artifactId>
88+
<executions>
89+
<execution>
90+
<id>copy-dependencies</id>
91+
<phase>prepare-package</phase>
92+
<goals>
93+
<goal>copy-dependencies</goal>
94+
</goals>
95+
<configuration>
96+
<outputDirectory>${project.build.directory}/libs</outputDirectory>
97+
</configuration>
98+
</execution>
99+
</executions>
100+
</plugin>
101+
</plugins>
102+
103+
</build>
104+
105+
<properties>
106+
107+
<!-- logging -->
108+
<org.slf4j.version>1.7.21</org.slf4j.version>
109+
<logback.version>1.1.7</logback.version>
110+
111+
<!-- testing -->
112+
<testng.version>6.10</testng.version>
113+
114+
<!-- maven plugins -->
115+
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
116+
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
117+
118+
</properties>
119119

120120

121121
</project>

‎testng/src/test/java/baeldung/com/MultiThreadedTests.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import org.testng.annotations.Test;
55

66
public class MultiThreadedTests {
7-
7+
88
@Test(threadPoolSize = 5, invocationCount = 10, timeOut = 1000)
9-
public void givenMethod_whenRunInThreads_thenCorrect(){
9+
public void givenMethod_whenRunInThreads_thenCorrect() {
1010
int count = Thread.activeCount();
11-
Assert.assertTrue(count>1);
11+
Assert.assertTrue(count > 1);
1212
}
1313

1414
}

‎testng/src/test/java/baeldung/com/TestGroup.java‎

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@
66

77
public class TestGroup {
88

9-
@BeforeGroups("database")
10-
public void setupDB() {
11-
System.out.println("setupDB()");
12-
}
13-
14-
@AfterGroups("database")
15-
public void cleanDB() {
16-
System.out.println("cleanDB()");
17-
}
18-
19-
@Test(groups= "selenium-test")
20-
public void runSelenium() {
21-
System.out.println("runSelenium()");
22-
}
23-
24-
@Test(groups= "selenium-test")
25-
public void runSelenium1() {
26-
System.out.println("runSelenium()1");
27-
}
28-
29-
@Test(groups = "database")
30-
public void testConnectOracle() {
31-
System.out.println("testConnectOracle()");
32-
}
33-
34-
@Test(groups = "database")
35-
public void testConnectMsSQL() {
36-
System.out.println("testConnectMsSQL");
37-
}
38-
39-
@Test(dependsOnGroups = {"database","selenium-test"})
40-
public void runFinal() {
41-
System.out.println("runFinal");
42-
}
9+
@BeforeGroups("database")
10+
public void setupDB() {
11+
System.out.println("setupDB()");
12+
}
13+
14+
@AfterGroups("database")
15+
public void cleanDB() {
16+
System.out.println("cleanDB()");
17+
}
18+
19+
@Test(groups = "selenium-test")
20+
public void runSelenium() {
21+
System.out.println("runSelenium()");
22+
}
23+
24+
@Test(groups = "selenium-test")
25+
public void runSelenium1() {
26+
System.out.println("runSelenium()1");
27+
}
28+
29+
@Test(groups = "database")
30+
public void testConnectOracle() {
31+
System.out.println("testConnectOracle()");
32+
}
33+
34+
@Test(groups = "database")
35+
public void testConnectMsSQL() {
36+
System.out.println("testConnectMsSQL");
37+
}
38+
39+
@Test(dependsOnGroups = {"database", "selenium-test"})
40+
public void runFinal() {
41+
System.out.println("runFinal");
42+
}
4343

4444
}

‎testng/src/test/java/com/baeldung/reports/CustomisedListener.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ public class CustomisedListener implements ITestListener {
1313
public void onFinish(ITestContext arg0) {
1414
LOGGER.info("PASSED TEST CASES");
1515
arg0.getPassedTests()
16-
.getAllResults()
17-
.stream()
18-
.forEach(result -> {
19-
LOGGER.info(result.getName());
20-
});
16+
.getAllResults()
17+
.stream()
18+
.forEach(result -> {
19+
LOGGER.info(result.getName());
20+
});
2121
LOGGER.info("FAILED TEST CASES");
2222
arg0.getFailedTests()
23-
.getAllResults()
24-
.stream()
25-
.forEach(result -> {
26-
LOGGER.info(result.getName());
27-
});
28-
LOGGER.info("Test completed on: "+arg0.getEndDate().toString());
23+
.getAllResults()
24+
.stream()
25+
.forEach(result -> {
26+
LOGGER.info(result.getName());
27+
});
28+
LOGGER.info("Test completed on: " + arg0.getEndDate().toString());
2929
}
3030

3131
@Override
3232
public void onStart(ITestContext arg0) {
3333
LOGGER.info("Started testing on: " + arg0.getStartDate()
34-
.toString());
34+
.toString());
3535
}
3636

3737
@Override

0 commit comments

Comments
 (0)