blob: 6e2a50d69544c8e6448b455b481a736ecf74e193 (
plain) (
blame)
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
|
package mill.testng;
import sbt.testing.*;
import org.testng.ITestResult;
public class ResultEvent {
static Event failure(ITestResult result){ return event(Status.Failure, result); }
static Event skipped(ITestResult result){ return event(Status.Skipped, result); }
static Event success(ITestResult result){ return event(Status.Success, result); }
static Event event(Status result, ITestResult testNGResult) {
return new Event() {
public String fullyQualifiedName() {
return testNGResult.getTestClass().getName();
}
public Fingerprint fingerprint() {
return TestNGFingerprint.instance;
}
public Selector selector() {
return new SuiteSelector();
}
public Status status() {
return result;
}
public OptionalThrowable throwable() {
if (result != Status.Success){
return new OptionalThrowable(testNGResult.getThrowable());
}else {
return new OptionalThrowable();
}
}
@Override
public long duration() {
return testNGResult.getEndMillis() - testNGResult.getStartMillis();
}
};
}
static String classNameOf(ITestResult result){ return result.getTestClass().getName(); }
}
|