1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.common;
17
18 import org.junit.runners.BlockJUnit4ClassRunner;
19 import org.junit.runners.model.FrameworkMethod;
20 import org.junit.runners.model.InitializationError;
21 import org.junit.runners.model.Statement;
22
23 import java.lang.reflect.Method;
24
25
26
27
28
29 public class SmokeTestRunner extends BlockJUnit4ClassRunner {
30
31
32
33
34
35
36 public SmokeTestRunner(Class<?> type) throws InitializationError {
37 super(type);
38 }
39
40 @Override
41 protected Statement methodInvoker(FrameworkMethod method, Object test) {
42 Method testMethod = method.getMethod();
43 final String testClass = test.getClass().toString();
44 if (testMethod.getName().endsWith("Bookmark") ||
45 (testClass.endsWith("WDIT")) ||
46 (testClass.endsWith("BkMrkGen"))) {
47 ((SmokeTestBase) test).enableBookmarkMode();
48 } else if (testMethod.getName().endsWith("Nav") ||
49 (testClass.endsWith("NavIT"))) {
50 ((SmokeTestBase) test).enableNavigationMode();
51 }
52 return super.methodInvoker(method, test);
53 }
54 }