forked from utPLSQL/utPLSQL-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunCommandIT.java
More file actions
92 lines (69 loc) · 2.55 KB
/
RunCommandIT.java
File metadata and controls
92 lines (69 loc) · 2.55 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
package org.utplsql.cli;
import org.junit.jupiter.api.Test;
import org.utplsql.api.compatibility.OptionalFeatures;
import org.utplsql.api.reporter.CoreReporters;
import java.nio.file.Paths;
import java.sql.SQLException;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* System tests for run command.
*/
class RunCommandIT extends AbstractFileOutputTest {
private void assertValidReturnCode(int returnCode) throws SQLException {
// Only expect failure-exit-code to work on several framework versions
if (OptionalFeatures.FAIL_ON_ERROR.isAvailableFor(TestHelper.getFrameworkVersion()))
assertEquals(2, returnCode);
else
assertEquals(0, returnCode);
}
@Test
void run_Default() throws Exception {
int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"-f=ut_documentation_reporter",
"-s",
"-c",
"--failure-exit-code=2");
assertValidReturnCode(result);
}
@Test
void run_Debug() throws Exception {
int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"--debug",
"--failure-exit-code=2");
assertValidReturnCode(result);
}
@Test
void run_MultipleReporters() throws Exception {
String outputFileName = "output_" + System.currentTimeMillis() + ".xml";
addTempPath(Paths.get(outputFileName));
int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"-f=ut_documentation_reporter",
"-s",
"-f=" + CoreReporters.UT_SONAR_TEST_REPORTER.name(),
"-o=" + outputFileName,
"-c",
"--failure-exit-code=2");
assertValidReturnCode(result);
}
@Test
void run_withDbmsOutputEnabled() throws Exception {
int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"-D",
"--failure-exit-code=2");
assertValidReturnCode(result);
}
@Test
void run_withOutputButNoReporterDefined() throws Exception {
String outputFileName = "output_" + System.currentTimeMillis() + ".xml";
addTempPath(Paths.get(outputFileName));
int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"-o=" + outputFileName,
"--failure-exit-code=2");
assertValidReturnCode(result);
}
}