-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTestRunnerIT.java
More file actions
98 lines (80 loc) · 3.17 KB
/
TestRunnerIT.java
File metadata and controls
98 lines (80 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package org.utplsql.api;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import org.utplsql.api.compatibility.CompatibilityProxy;
import org.utplsql.api.compatibility.OptionalFeatures;
import org.utplsql.api.db.DatabaseInformation;
import org.utplsql.api.db.DefaultDatabaseInformation;
import org.utplsql.api.exception.InvalidVersionException;
import org.utplsql.api.exception.SomeTestsFailedException;
import org.utplsql.api.reporter.CoreReporters;
import java.sql.Connection;
import java.sql.SQLException;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Integration-test for TestRunner
*
* @author viniciusam
* @author pesse
*/
class TestRunnerIT extends AbstractDatabaseTest {
@Test
void runWithDefaultParameters() throws SQLException {
new TestRunner().run(getConnection());
}
/**
* This can only be run against versions >= 3.0.3
*/
@Test
void runWithoutCompatibilityCheck() throws SQLException, InvalidVersionException {
DatabaseInformation databaseInformation = new DefaultDatabaseInformation();
// We can only test this for the versions of the latest TestRunnerStatement-Change
if ( OptionalFeatures.RANDOM_EXECUTION_ORDER.isAvailableFor(databaseInformation.getUtPlsqlFrameworkVersion(getConnection())) ) {
new TestRunner()
.skipCompatibilityCheck(true)
.run(getConnection());
}
}
@Test
void runWithManyReporters() throws SQLException {
Connection conn = getConnection();
new TestRunner()
.addPath(getUser())
.addReporter(CoreReporters.UT_DOCUMENTATION_REPORTER.name())
.addReporter(CoreReporters.UT_COVERAGE_HTML_REPORTER.name())
.addReporter(CoreReporters.UT_COVERAGE_SONAR_REPORTER.name())
.addReporter(CoreReporters.UT_COVERALLS_REPORTER.name())
.addReporter(CoreReporters.UT_SONAR_TEST_REPORTER.name())
.addReporter(CoreReporters.UT_TEAMCITY_REPORTER.name())
.addReporter(CoreReporters.UT_XUNIT_REPORTER.name())
.run(conn);
}
/**
* This can only be tested on frameworks >= 3.0.3
*/
@Test
void failOnErrors() throws SQLException, InvalidVersionException {
Connection conn = getConnection();
CompatibilityProxy proxy = new CompatibilityProxy(conn);
if (proxy.getUtPlsqlVersion().isGreaterOrEqualThan(Version.V3_0_3)) {
Executable throwingTestRunner = () -> new TestRunner()
.failOnErrors(true)
.run(conn);
assertThrows(SomeTestsFailedException.class, throwingTestRunner);
}
}
@Test
void runWithRandomExecutionOrder() throws SQLException {
CompatibilityProxy proxy = new CompatibilityProxy(getConnection());
new TestRunner()
.randomTestOrder(true)
.randomTestOrderSeed(123)
.run(getConnection());
}
@Test
void runWithTags() throws SQLException {
new TestRunner()
.addTag("none")
.run(getConnection());
}
}