-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTestRunnerIT.java
More file actions
76 lines (62 loc) · 2.42 KB
/
TestRunnerIT.java
File metadata and controls
76 lines (62 loc) · 2.42 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
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.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 {
CompatibilityProxy proxy = new CompatibilityProxy(getConnection());
if (proxy.getDatabaseVersion().isGreaterOrEqualThan(Version.V3_0_3)) {
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.getDatabaseVersion().isGreaterOrEqualThan(Version.V3_0_3)) {
Executable throwingTestRunner = () -> new TestRunner()
.failOnErrors(true)
.run(conn);
assertThrows(SomeTestsFailedException.class, throwingTestRunner);
}
}
}