private ITestResult createTestResult(Description test) { JUnit4TestClass tc = new JUnit4TestClass(test); JUnitTestMethod tm = new JUnit4TestMethod(tc, test); TestResult tr = new TestResult(tc, test, tm, null, Calendar.getInstance().getTimeInMillis(), 0, null); InvokedMethod im = new InvokedMethod(tr.getTestClass(), tr.getMethod(), tr.getStartMillis(), tr); m_parentRunner.addInvokedMethod(im); for (IInvokedMethodListener l: m_invokeListeners) { l.beforeInvocation(im, tr); } return tr; }
public static TestResult newTestResultFrom(TestResult result, ITestNGMethod method, ITestContext ctx, long start) { TestResult testResult = newEmptyTestResult(); testResult.setHost(result.getHost()); testResult.setParameters(result.getParameters()); testResult.init(method, ctx, null, start, 0L); TestResult.copyAttributes(result, testResult); return testResult; }
public static TestResult newEndTimeAwareTestResult(ITestNGMethod method, ITestContext ctx, Throwable t, long start) { TestResult result = newEmptyTestResult(); long time = System.currentTimeMillis(); result.init(method, ctx, t, start, time); return result; }
ConfigurationGroupMethods groupMethods, FailureContext failureContext) { TestResult testResult = new TestResult(); m_notifier.addSkippedTest(tm, result); tm.incrementCurrentInvocationCount(); testResult.setMethod(tm); runInvokedMethodListeners(BEFORE_INVOCATION, invokedMethod, testResult); runInvokedMethodListeners(AFTER_INVOCATION, invokedMethod, testResult); testResult.init(testClass, instance, tm, null, System.currentTimeMillis(), 0, m_testContext); testResult.setParameters(parameterValues); testResult.setParameterIndex(parametersIndex); testResult.setHost(m_testContext.getHost()); testResult.setStatus(ITestResult.STARTED); testResult.setThrowable(ite.getCause()); setTestStatus(testResult, ITestResult.FAILURE); Throwable cause= tee.getCause(); if(TestNGRuntimeException.class.equals(cause.getClass())) { testResult.setThrowable(cause.getCause()); testResult.setThrowable(cause); testResult.setThrowable(thr); setTestStatus(testResult, ITestResult.FAILURE); testResult.setEndMillis(System.currentTimeMillis());
private ITestResult invokeMethod( TestMethodArguments arguments, XmlSuite suite, FailureContext failureContext) { TestResult testResult = TestResult.newEmptyTestResult(); arguments.getInstance()); ITestResult result = registerSkippedTestResult(arguments.getTestMethod(), System.currentTimeMillis(), exception); TestResult.copyAttributes(testResult, result); m_notifier.addSkippedTest(arguments.getTestMethod(), result); arguments.getTestMethod().incrementCurrentInvocationCount(); testResult.setMethod(arguments.getTestMethod()); invokedMethod = new InvokedMethod(arguments.getInstance(), arguments.getTestMethod(), startTime, result); .newTestResultFrom(testResult, arguments.getTestMethod(), m_testContext, System.currentTimeMillis()); testResult.setParameters(arguments.getParameterValues()); testResult.setParameterIndex(arguments.getParametersIndex()); testResult.setHost(m_testContext.getHost()); testResult.setStatus(ITestResult.STARTED); testResult.setThrowable(ite.getCause()); setTestStatus(testResult, ITestResult.FAILURE); } catch (ThreadExecutionException tee) { // wrapper for TestNGRuntimeException Throwable cause = tee.getCause(); if (TestNGRuntimeException.class.equals(cause.getClass())) { testResult.setThrowable(cause.getCause()); } else { testResult.setThrowable(cause); testResult.setThrowable(thr);
private ITestResult createTestResult(Description test) { JUnit4TestClass tc = new JUnit4TestClass(test); JUnitTestMethod tm = new JUnit4TestMethod(tc, test); TestResult tr = TestResult.newTestResultFor(tm); InvokedMethod im = new InvokedMethod(tr.getTestClass(), tr.getMethod(), tr.getStartMillis(), tr); m_parentRunner.addInvokedMethod(im); for (IInvokedMethodListener l : m_invokeListeners) { l.beforeInvocation(im, tr); } return tr; }
public static TestResult newEmptyTestResult() { return new TestResult(); }
@Override public String toString() { List<String> output = Reporter.getOutput(this); return Objects.toStringHelper(getClass()) .omitNulls() .omitEmptyStrings() .add("name", getName()) .add("status", toString(m_status)) .add("method", m_method) .add("output", output != null && output.size() > 0 ? output.get(0) : null) .toString(); }
private org.testng.internal.TestResult recordResults(Test test, TestRunInfo tri) { JUnitTestClass tc= new JUnit3TestClass(test); JUnitTestMethod tm= new JUnit3TestMethod(tc, test); org.testng.internal.TestResult tr= new org.testng.internal.TestResult(tc, test, tm, tri.m_failure, tri.m_start, Calendar.getInstance().getTimeInMillis(), null); if(tri.isFailure()) { tr.setStatus(ITestResult.FAILURE); m_parentRunner.addFailedTest(tm, tr); } else { m_parentRunner.addPassedTest(tm, tr); } InvokedMethod im = new InvokedMethod(test, tm, tri.m_start, tr); m_parentRunner.addInvokedMethod(im); m_methods.add(tm); for (IInvokedMethodListener l: m_invokedMethodListeners) { l.beforeInvocation(im, tr); } return tr; }
ITestResult testResult = new TestResult(testClass, instanceTouse, tm, null, time, time, m_testContext); ((TestResult) testMethodResult).setMethod(currentTestMethod);
@Override public int compareTo(ITestResult comparison) { return Long.compare(getStartMillis(), comparison.getStartMillis()); }
String string = m_instance.toString(); m_name = getMethod().getMethodName(); try { if (!Object.class.getMethod("toString")
public TestResult(IClass testClass, Object instance, ITestNGMethod method, Throwable throwable, long start, long end, ITestContext context) { init(testClass, instance, method, throwable, start, end, context); }
private ITestResult registerSkippedTestResult(ITestNGMethod testMethod, Object instance, long start, Throwable throwable) { ITestResult result = new TestResult(testMethod.getTestClass(), instance, testMethod, throwable, start, System.currentTimeMillis(), m_testContext); result.setStatus(TestResult.SKIP); Reporter.setCurrentTestResult(result); runTestListeners(result); return result; }
@Override public String toString() { List<String> output = Reporter.getOutput(this); return Objects.toStringHelper(getClass()) .omitNulls() .omitEmptyStrings() .add("name", getName()) .add("status", toString(m_status)) .add("method", m_method) .add("output", output != null && output.size() > 0 ? output.get(0) : null) .toString(); }
public static TestResult newTestResultWithCauseAs(ITestNGMethod method, ITestContext ctx, Throwable t) { TestResult result = newEmptyTestResult(); long time = System.currentTimeMillis(); result.init(method, ctx, t, time, time); return result; }
@Override public int compareTo(@Nonnull ITestResult comparison) { return Long.compare(getStartMillis(), comparison.getStartMillis()); }
m_name = getMethod().getMethodName(); try { if (!Object.class
while (m_invocationCount-- > 0) { ITestResult r = new TestResult(m_testMethod.getTestClass(), m_instance, m_testMethod,
public static TestResult newContextAwareTestResult(ITestNGMethod method, ITestContext ctx) { TestResult result = newEmptyTestResult(); long time = System.currentTimeMillis(); result.init(method, ctx, null, time, 0L); return result; }