01: package test;
02:
03: import test.sample.BaseSampleInheritance;
04:
05: public class SampleInheritance extends BaseSampleInheritance {
06: // Test dependency of configuration methods
07: /**
08: * @testng.before-class groups="configuration0"
09: */
10: public void configuration0() {
11: addConfiguration("configuration0");
12: // System.out.println("CONFIGURATION 0");
13: }
14:
15: /**
16: * @testng.before-class
17: * dependsOnGroups="configuration1"
18: */
19: public void configuration2() {
20: assert m_configurations.size() == 2 : "Expected size 2 found "
21: + m_configurations.size();
22: assert "configuration0".equals(m_configurations.get(0)) : "Expected configuration0 to be run";
23: assert "configuration1".equals(m_configurations.get(1)) : "Expected configuration1 to be run";
24: addConfiguration("configuration2");
25: assert m_configurations.size() == 3 : "after configuration2() should be 3. Found: "
26: + m_configurations.size();
27: }
28:
29: /**
30: * @testng.test dependsOnGroups="inheritedTestMethod"
31: */
32: public void inheritedMethodsWereCalledInOrder() {
33: assert m_invokedBaseMethod : "Didn't invoke test method in base class";
34: assert m_invokedBaseConfiguration : "Didn't invoke configuration method in base class";
35:
36: }
37:
38: /**
39: * @testng.test
40: */
41: public void configurationsWereCalledInOrder() {
42: assert m_configurations.size() == 3 : "Expected 3 configurations. Found only "
43: + m_configurations.size();
44: assert "configuration0".equals(m_configurations.get(0)) : "Expected configuration0 to be run";
45: assert "configuration1".equals(m_configurations.get(1)) : "Expected configuration1 to be run";
46: assert "configuration2".equals(m_configurations.get(2)) : "Expected configuration1 to be run";
47: }
48: }
|