@Override public boolean isBeforeMethodConfiguration() { return testNGMethod.isBeforeMethodConfiguration(); }
@Override public boolean isBeforeMethodConfiguration() { return testNGMethod.isBeforeMethodConfiguration(); }
private static boolean isConfigMethodEligibleForScrutiny(ITestNGMethod tm) { if (!tm.isBeforeMethodConfiguration()) { return false; } if (!(tm instanceof ConfigurationMethod)) { return false; } ConfigurationMethod cfg = (ConfigurationMethod) tm; return cfg.isFirstTimeOnly(); }
private boolean isRelated(ITestResult result) { ITestNGMethod m = result.getMethod(); if (!m.isBeforeClassConfiguration() && !m.isBeforeMethodConfiguration()) { return false; } Object current = this.getInstance(); Object thatObject = result.getInstance(); return current.getClass().isAssignableFrom(thatObject.getClass()) || thatObject.getClass().isAssignableFrom(current.getClass()); }
private static List<ITestNGMethod> sortMethods(boolean forTests, List<ITestNGMethod> allMethods, Comparator<ITestNGMethod> comparator) { List<ITestNGMethod> sl = Lists.newArrayList(); List<ITestNGMethod> pl = Lists.newArrayList(); ITestNGMethod[] allMethodsArray = allMethods.toArray(new ITestNGMethod[allMethods.size()]); // Fix the method inheritance if these are @Configuration methods to make // sure base classes are invoked before child classes if 'before' and the // other way around if they are 'after' if (!forTests && allMethodsArray.length > 0) { ITestNGMethod m = allMethodsArray[0]; boolean before = m.isBeforeClassConfiguration() || m.isBeforeMethodConfiguration() || m.isBeforeSuiteConfiguration() || m.isBeforeTestConfiguration(); MethodInheritance.fixMethodInheritance(allMethodsArray, before); } topologicalSort(allMethodsArray, sl, pl, comparator); List<ITestNGMethod> result = Lists.newArrayList(); result.addAll(sl); result.addAll(pl); return result; }
boolean bg = tm.isBeforeGroupsConfiguration(); boolean ag = tm.isAfterGroupsConfiguration(); boolean setUp = tm.isBeforeMethodConfiguration(); boolean tearDown = tm.isAfterMethodConfiguration(); boolean isClassConfiguration = bc || ac;
private static String typeOfMethod(IInvokedMethod method) { ITestNGMethod tm = method.getTestMethod(); if (tm.isBeforeMethodConfiguration()) { return "before_method: "; } if (tm.isAfterMethodConfiguration()) { return "after_method: "; } return "test_method: "; }
boolean bg = tm.isBeforeGroupsConfiguration(); boolean ag = tm.isAfterGroupsConfiguration(); boolean setUp = tm.isBeforeMethodConfiguration(); boolean tearDown = tm.isAfterMethodConfiguration(); boolean isClassConfiguration = bc || ac;
private static List<ITestNGMethod> sortMethods( boolean forTests, List<ITestNGMethod> allMethods, Comparator<ITestNGMethod> comparator) { List<ITestNGMethod> sl = Lists.newArrayList(); List<ITestNGMethod> pl = Lists.newArrayList(); ITestNGMethod[] allMethodsArray = allMethods.toArray(new ITestNGMethod[0]); // Fix the method inheritance if these are @Configuration methods to make // sure base classes are invoked before child classes if 'before' and the // other way around if they are 'after' if (!forTests && allMethodsArray.length > 0) { ITestNGMethod m = allMethodsArray[0]; boolean before = m.isBeforeClassConfiguration() || m.isBeforeMethodConfiguration() || m.isBeforeSuiteConfiguration() || m.isBeforeTestConfiguration(); MethodInheritance.fixMethodInheritance(allMethodsArray, before); } topologicalSort(allMethodsArray, sl, pl, comparator); List<ITestNGMethod> result = Lists.newArrayList(); result.addAll(sl); result.addAll(pl); return result; }
/** * * A helper method that checks to see if a method is a configuration method or not. * @param method - A {@link ITestNGMethod} object which needs to be checked. * @param includeGroupConfigs - <code>true</code> if before/after group configuration annotations are also to * be taken into consideration. * @return - <code>true</code> if the method is a configuration method and false if its a test method. */ private static boolean isConfigurationMethod(ITestNGMethod method, boolean includeGroupConfigs) { boolean flag = method.isBeforeMethodConfiguration() || method.isAfterMethodConfiguration() || method.isBeforeTestConfiguration() || method.isAfterTestConfiguration() || method.isBeforeClassConfiguration() || method.isAfterClassConfiguration() || method.isBeforeSuiteConfiguration() || method.isAfterSuiteConfiguration(); if (includeGroupConfigs) { flag = flag || method.isBeforeGroupsConfiguration() || method.isAfterGroupsConfiguration(); } return flag; }
addResults(tc.getFailedConfigurations().getAllResults(), results); for (ITestResult tr : tc.getPassedConfigurations().getAllResults()) { if (tr.getMethod().isBeforeMethodConfiguration()) { befores.put(tr.getInstance(), tr);
addResults(tc.getFailedConfigurations().getAllResults(), results); for (ITestResult tr : tc.getPassedConfigurations().getAllResults()) { if (tr.getMethod().isBeforeMethodConfiguration()) { befores.put(tr.getInstance(), tr);
return 7; if(method.isBeforeMethodConfiguration()) { return 6;
return "@BeforeGroups"; if(method.isBeforeMethodConfiguration()) { return "@BeforeMethod";
/** * A helper method that checks to see if a method is a configuration method or not. * * @param method - A {@link ITestNGMethod} object which needs to be checked. * @param includeGroupConfigs - <code>true</code> if before/after group configuration annotations * are also to be taken into consideration. * @return - <code>true</code> if the method is a configuration method and false if its a test * method. */ private static boolean isConfigurationMethod(ITestNGMethod method, boolean includeGroupConfigs) { boolean flag = method.isBeforeMethodConfiguration() || method.isAfterMethodConfiguration() || method.isBeforeTestConfiguration() || method.isAfterTestConfiguration() || method.isBeforeClassConfiguration() || method.isAfterClassConfiguration() || method.isBeforeSuiteConfiguration() || method.isAfterSuiteConfiguration(); if (includeGroupConfigs) { flag = flag || method.isBeforeGroupsConfiguration() || method.isAfterGroupsConfiguration(); } return flag; }
return 7; if (method.isBeforeMethodConfiguration()) { return 6;
return "@BeforeGroups"; if (method.isBeforeMethodConfiguration()) { return "@BeforeMethod";
} else if (m.isAfterClassConfiguration()) { cls = "configuration-class after"; } else if (m.isBeforeMethodConfiguration()) { cls = "configuration-method before"; } else if (m.isAfterMethodConfiguration()) {
} else if (m.isAfterClassConfiguration()) { cls = "configuration-class after"; } else if (m.isBeforeMethodConfiguration()) { cls = "configuration-method before"; } else if (m.isAfterMethodConfiguration()) {
@Override public void afterInvocation(IInvokedMethod method, ITestResult testResult) { String methodName = method.getTestMethod().getMethodName(); if (method.isTestMethod()) { testMethods.add(methodName); } if (method.isConfigurationMethod()) { configurationMethods.add(methodName); } if (method.getTestMethod().isTest()) { testMethodsFromTM.add(methodName); } if (method.getTestMethod().isBeforeMethodConfiguration() || method.getTestMethod().isAfterMethodConfiguration() || method.getTestMethod().isBeforeTestConfiguration() || method.getTestMethod().isAfterTestConfiguration() || method.getTestMethod().isBeforeClassConfiguration() || method.getTestMethod().isAfterClassConfiguration() || method.getTestMethod().isBeforeSuiteConfiguration() || method.getTestMethod().isAfterSuiteConfiguration()) { configurationMethodsFromTM.add(methodName); } } }