Java Code Examples for org.testng.ITestResult#setParameters()

The following examples show how to use org.testng.ITestResult#setParameters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoggingTestCase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 2
Source File: LoggingTestCase.java    From streamsupport with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 3
Source File: LoggingTestCase.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 4
Source File: LoggingTestCase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 5
Source File: JavacTemplateTestBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 6
Source File: LoggingTestCase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 7
Source File: JavacTemplateTestBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 8
Source File: LoggingTestCase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 9
Source File: JavacTemplateTestBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 10
Source File: LoggingTestCase.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 11
Source File: LoggingTestCase.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 12
Source File: JavacTemplateTestBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 13
Source File: LoggingTestCase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 14
Source File: CacheValidationListener.java    From caffeine with Apache License 2.0 5 votes vote down vote up
/** Free memory by clearing unused resources after test execution. */
private void cleanUp(ITestResult testResult) {
  boolean briefParams = !detailedParams.get();

  if (testResult.isSuccess() && briefParams) {
    testResult.setParameters(EMPTY_PARAMS);
    testResult.setThrowable(null);
  }

  Object[] params = testResult.getParameters();
  for (int i = 0; i < params.length; i++) {
    Object param = params[i];
    if ((param instanceof AsyncCache<?, ?>) || (param instanceof Cache<?, ?>)
        || (param instanceof Map<?, ?>) || (param instanceof Eviction<?, ?>)
        || (param instanceof Expiration<?, ?>) || (param instanceof VarExpiration<?, ?>)
        || ((param instanceof CacheContext) && briefParams)) {
      params[i] = simpleNames.get(param.getClass(), key -> ((Class<?>) key).getSimpleName());
    } else if (param instanceof CacheContext) {
      params[i] = simpleNames.get(param.toString(), Object::toString);
    } else {
      params[i] = Objects.toString(param);
    }
  }

  /*
  // Enable in TestNG 7.0
  if ((testResult.getName() != null) && briefParams) {
    testResult.setTestName(simpleNames.get(testResult.getName(), Object::toString));
  }
  */

  CacheSpec.interner.get().clear();
}
 
Example 15
Source File: LoggingTestCase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 16
Source File: JavacTemplateTestBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 17
Source File: LoggingTestCase.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 18
Source File: JavacTemplateTestBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 19
Source File: LoggingTestCase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
Example 20
Source File: JavacTemplateTestBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}