• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package test.methodselectors;
2 
3 import org.testng.IMethodSelector;
4 import org.testng.IMethodSelectorContext;
5 import org.testng.ITestNGMethod;
6 
7 import java.util.List;
8 
9 public class NoTest1MethodSelector implements IMethodSelector {
10 
11   /**
12    *
13    */
14   private static final long serialVersionUID = 6706869410370733524L;
15 
16   @Override
includeMethod(IMethodSelectorContext context, ITestNGMethod method, boolean isTestMethod)17   public boolean includeMethod(IMethodSelectorContext context,
18       ITestNGMethod method, boolean isTestMethod)
19   {
20     for (String group : method.getGroups()) {
21       if (group.equals("test1")) {
22         ppp( method.getMethodName() + " is group test1, don't include" );
23         context.setStopped(true);
24         return false;
25       }
26     }
27     ppp( method.getMethodName() + " is not in group test1" );
28     return true;
29   }
30 
31   @Override
setTestMethods(List<ITestNGMethod> testMethods)32   public void setTestMethods(List<ITestNGMethod> testMethods) {
33 
34   }
35 
ppp(String s)36   public static void ppp(String s) {
37     //System.out.println("[NoTest1MethodSelector] " + s);
38   }
39 
40 }
41