forked from testng-team/testng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IssueTest.java
59 lines (54 loc) · 2.47 KB
/
IssueTest.java
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
package test.listeners.issue1777;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import org.testng.TestNG;
import org.testng.annotations.Test;
import org.testng.xml.XmlSuite;
import test.SimpleBaseTest;
public class IssueTest extends SimpleBaseTest {
public static final String GITHUB_1777 = "GITHUB-1777";
@Test(description = GITHUB_1777)
public void testOnStartInvokedForSkippedTests() {
TestNG testNG = create(TestClassSample.class);
testNG.alwaysRunListeners(true);
testNG.setConfigFailurePolicy(XmlSuite.FailurePolicy.CONTINUE);
MyListener listener = new MyListener();
testNG.addListener(listener);
testNG.run();
List<String> expectedTestMessages =
Arrays.asList(
"testStart_test_method: test1",
"before_test_method: test1",
"before_test_method: test1",
"after_test_method: test1",
"after_test_method: test1",
"testSuccess_test_method: test1",
"testStart_test_method: test2",
"before_test_method: test2",
"before_test_method: test2",
"after_test_method: test2",
"after_test_method: test2",
"testSuccess_test_method: test2");
assertThat(listener.tstMsgs).containsExactlyElementsOf(expectedTestMessages);
List<String> expectedConfigMessages =
Arrays.asList(
"before_configuration_method: beforeMethod[test1]",
"before_configuration_method: beforeMethod[test1]",
"after_configuration_method: beforeMethod[test1]",
"after_configuration_method: beforeMethod[test1]",
"before_configuration_method: afterMethod[test1]",
"before_configuration_method: afterMethod[test1]",
"after_configuration_method: afterMethod[test1]",
"after_configuration_method: afterMethod[test1]",
"before_configuration_method: beforeMethod[test2]",
"before_configuration_method: beforeMethod[test2]",
"after_configuration_method: beforeMethod[test2]",
"after_configuration_method: beforeMethod[test2]",
"before_configuration_method: afterMethod[test2]",
"before_configuration_method: afterMethod[test2]",
"after_configuration_method: afterMethod[test2]",
"after_configuration_method: afterMethod[test2]");
assertThat(listener.cfgMsgs).containsExactlyElementsOf(expectedConfigMessages);
}
}