org.testng.ITestNGMethod#isBeforeClassConfiguration ( )源码实例Demo

下面列出了org.testng.ITestNGMethod#isBeforeClassConfiguration ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: qaf   文件: MethodHelper.java
private static List<ITestNGMethod> sortMethods(boolean forTests,
    List<ITestNGMethod> allMethods, IAnnotationFinder finder) {
  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);

  List<ITestNGMethod> result = Lists.newArrayList();
  result.addAll(sl);
  result.addAll(pl);
  return result;
}
 
源代码2 项目: allure-java   文件: AllureTestNg.java
private void ifClassFixtureStarted(final ITestNGMethod testMethod) {
    if (testMethod.isBeforeClassConfiguration()) {
        getClassContainer(testMethod.getTestClass())
                .ifPresent(parentUuid -> startBefore(parentUuid, testMethod));
    }
    if (testMethod.isAfterClassConfiguration()) {
        getClassContainer(testMethod.getTestClass())
                .ifPresent(parentUuid -> startAfter(parentUuid, testMethod));
    }
}
 
源代码3 项目: allure-java   文件: AllureTestNg.java
@SuppressWarnings("BooleanExpressionComplexity")
private boolean isSupportedConfigurationFixture(final ITestNGMethod testMethod) {
    return testMethod.isBeforeMethodConfiguration() || testMethod.isAfterMethodConfiguration()
            || testMethod.isBeforeTestConfiguration() || testMethod.isAfterTestConfiguration()
            || testMethod.isBeforeClassConfiguration() || testMethod.isAfterClassConfiguration()
            || testMethod.isBeforeSuiteConfiguration() || testMethod.isAfterSuiteConfiguration();
}
 
源代码4 项目: brooklyn-server   文件: VerboseReporter.java
/**
 *
 * @param method method to be described
 * @return FQN of a class + method declaration for a method passed in
 *      ie. test.triangle.CheckCount.testCheckCount(java.lang.String)
 */
private String getMethodDeclaration(ITestNGMethod method) {
    //see Utils.detailedMethodName
    //perhaps should rather adopt the original method instead
    ConstructorOrMethod m = method.getConstructorOrMethod();
    StringBuilder buf = new StringBuilder();
    buf.append("\"");
    if (suiteName != null) {
        buf.append(suiteName);
    } else {
        buf.append("UNKNOWN");
    }
    buf.append("\"");
    buf.append(" - ");
    if (method.isBeforeSuiteConfiguration()) {
        buf.append("@BeforeSuite ");
    } else if (method.isBeforeTestConfiguration()) {
        buf.append("@BeforeTest ");
    } else if (method.isBeforeClassConfiguration()) {
        buf.append("@BeforeClass ");
    } else if (method.isBeforeGroupsConfiguration()) {
        buf.append("@BeforeGroups ");
    } else if (method.isBeforeMethodConfiguration()) {
        buf.append("@BeforeMethod ");
    } else if (method.isAfterMethodConfiguration()) {
        buf.append("@AfterMethod ");
    } else if (method.isAfterGroupsConfiguration()) {
        buf.append("@AfterGroups ");
    } else if (method.isAfterClassConfiguration()) {
        buf.append("@AfterClass ");
    } else if (method.isAfterTestConfiguration()) {
        buf.append("@AfterTest ");
    } else if (method.isAfterSuiteConfiguration()) {
        buf.append("@AfterSuite ");
    }
    buf.append(m.getDeclaringClass().getName());
    buf.append(".");
    buf.append(m.getName());
    buf.append("(");
    int i = 0;
    for (Class<?> p : m.getParameterTypes()) {
        if (i++ > 0) {
            buf.append(", ");
        }
        buf.append(p.getName());
    }
    buf.append(")");
    return buf.toString();
}