-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTestRunnerTest.java
More file actions
65 lines (57 loc) · 1.91 KB
/
TestRunnerTest.java
File metadata and controls
65 lines (57 loc) · 1.91 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
package org.utplsql.api;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.utplsql.api.exception.SomeTestsFailedException;
import org.utplsql.api.reporter.*;
import org.utplsql.api.rules.DatabaseRule;
import java.sql.Connection;
import java.sql.SQLException;
/**
* Created by Vinicius on 13/04/2017.
*/
public class TestRunnerTest {
@Rule
public final DatabaseRule db = new DatabaseRule();
@Test
public void runWithDefaultParameters() {
try {
Connection conn = db.newConnection();
new TestRunner().run(conn);
} catch (SQLException e) {
Assert.fail(e.getMessage());
}
}
@Test
public void runWithManyReporters() {
try {
Connection conn = db.newConnection();
new TestRunner()
.addPath(db.getUser())
.addReporter(new DocumentationReporter().init(conn))
.addReporter(new CoverageHTMLReporter().init(conn))
.addReporter(new CoverageSonarReporter().init(conn))
.addReporter(new CoverallsReporter().init(conn))
.addReporter(new SonarTestReporter().init(conn))
.addReporter(new TeamCityReporter().init(conn))
.addReporter(new XUnitReporter().init(conn))
.run(conn);
} catch (SQLException e) {
Assert.fail(e.getMessage());
}
}
@Test
public void failOnErrors() {
try {
Connection conn = db.newConnection();
new TestRunner()
.failOnErrors(true)
.run(conn);
Assert.fail();
} catch (SomeTestsFailedException ignored) {
System.out.println("Expected exception object thrown.");
} catch (SQLException e) {
Assert.fail("Wrong exception object thrown.");
}
}
}