當前位置: 首頁>>代碼示例>>Java>>正文


Java IInvokedMethod.isTestMethod方法代碼示例

本文整理匯總了Java中org.testng.IInvokedMethod.isTestMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java IInvokedMethod.isTestMethod方法的具體用法?Java IInvokedMethod.isTestMethod怎麽用?Java IInvokedMethod.isTestMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.testng.IInvokedMethod的用法示例。


在下文中一共展示了IInvokedMethod.isTestMethod方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) {
    if (method.isTestMethod() && testResult.getStatus() == SUCCESS) {
        try {
            getSoftAssert().assertAll();
        } catch (AssertionError e) {
            testResult.getTestContext().getPassedTests().removeResult(testResult.getMethod());
            testResult.setStatus(TestResult.FAILURE);
            testResult.setThrowable(e);
        }
        THREAD_LOCAL_CONTAINER_FOR_SOFT_ASSERTIONS.remove();
    }
}
 
開發者ID:sskorol,項目名稱:qaa-amazon,代碼行數:14,代碼來源:SoftAssertListener.java

示例2: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
    if (testResult.getInstance() instanceof IInvokedMethodListenerEx) {
        ((IInvokedMethodListenerEx) testResult.getInstance()).afterInvocation(method, testResult);
    }
    
    if (method.getTestMethod().isBeforeMethodConfiguration()) {
        // merge with attributes from prior methods
        Map<String, Object> attributes = fromBefore.get();
        attributes.putAll(PropertyManager.extractAttributes(testResult));
        fromBefore.set(attributes);
    } else if (method.isTestMethod()) {
        fromMethod.set(PropertyManager.extractAttributes(testResult));
    } else if (method.getTestMethod().isAfterMethodConfiguration()) {
        // nothing to do here
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:18,代碼來源:ExecutionFlowController.java

示例3: beforeInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
    if (method.getTestMethod().isBeforeMethodConfiguration()) {
        // nothing to do here
    } else if (method.isTestMethod()) {
        PropertyManager.injectAttributes(fromBefore.get(), testResult);
        fromBefore.remove();
    } else if (method.getTestMethod().isAfterMethodConfiguration()) {
        PropertyManager.injectAttributes(fromMethod.get(), testResult);
        fromMethod.remove();
    }
    
    if (testResult.getInstance() instanceof IInvokedMethodListenerEx) {
        ((IInvokedMethodListenerEx) testResult.getInstance()).beforeInvocation(method, testResult);
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:17,代碼來源:ExecutionFlowController.java

示例4: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
/**
 * After invocation.
 * 
 * @param method
 *            the method
 * @param result
 *            the result
 * @see org.testng.IInvokedMethodListener#afterInvocation(org.testng.IInvokedMethod,
 *      org.testng.ITestResult)
 */
@Override
public final void afterInvocation(final IInvokedMethod method,
        final ITestResult result) {
    if (method.isTestMethod()) {
        if (result.getStatus() == ITestResult.SKIP) {
            endTestReporting("skipped");
        } else if (result.getStatus() == ITestResult.FAILURE) {
            endTestReporting("failed");
        } else if (result.getStatus() == ITestResult.SUCCESS) {
            endTestReporting("passed");
        }

    }

}
 
開發者ID:VTAF,項目名稱:VirtusaSeleniumWebdriverRuntime,代碼行數:26,代碼來源:VTAFTestListener.java

示例5: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult, ITestContext context)
{
    if ( method.isTestMethod() )
    {
        RetryContext retryContext = (RetryContext)context.getAttribute(ATTRIBUTE_NAME);
        if ( retryContext == null )
        {
            log.error("No retryContext!");
        }
        else
        {
            if ( testResult.isSuccess() || (testResult.getStatus() == ITestResult.FAILURE) )
            {
                retryContext.isRetrying.set(false);
                if ( retryContext.runVersion.incrementAndGet() > 1 )
                {
                    context.setAttribute(ATTRIBUTE_NAME, null);
                }
            }
        }
    }
}
 
開發者ID:apache,項目名稱:curator,代碼行數:24,代碼來源:BaseClassForTests.java

示例6: beforeInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void beforeInvocation(IInvokedMethod m, ITestResult res) {
  if (m.isTestMethod()) {
    File videoFile = new File(
        res.getTestContext().getOutputDirectory(),
        m.getTestMethod().getMethodName() + ".flv");
    screencaster = new VideoCreator(videoFile);
    videoThread = new Thread(new Runnable() {
      @Override
      public void run() {
        screencaster.createVideoFromScreens();
      }
    });
    videoThread.start();
  }
}
 
開發者ID:barancev,項目名稱:testng_samples,代碼行數:17,代碼來源:VideoListener.java

示例7: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod m, ITestResult res) {
  if (m.isTestMethod() && screencaster !=  null) {
    try {
      Thread.sleep(2000);
      screencaster.setPleaseStop(true);
      while (! screencaster.isStoppedCreation()) {
        Thread.sleep(500);
      }
      videoThread.join();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    screencaster = null;
    videoThread = null;
  }
}
 
開發者ID:barancev,項目名稱:testng_samples,代碼行數:18,代碼來源:VideoListener.java

示例8: apply

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public boolean apply(IInvokedMethod method) {
	if (!method.isTestMethod()) {
		return false;
	}
	Test testAnnotation = method.getTestMethod().getConstructorOrMethod().getMethod().getAnnotation(Test.class);

	if (null == testAnnotation) {
		return false;
	}

	if (testAnnotation.expectedExceptions().length == 0) {
		return false;
	}
	return Arrays.asList(testAnnotation.expectedExceptions()).contains(SoftAssertException.class);
}
 
開發者ID:smarttested,項目名稱:smartassert,代碼行數:17,代碼來源:SoftValidationMethodListener.java

示例9: beforeInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void beforeInvocation(IInvokedMethod iInvokedMethod, ITestResult iTestResult) {
    if (iInvokedMethod.isTestMethod()) {
        Reporter.setCurrentTestResult(iTestResult);
        removeAttributes(iTestResult);
        Method testMethod = iInvokedMethod.getTestMethod().getConstructorOrMethod().getMethod();
        if (testMethod.isAnnotationPresent(Test.class)) {
            String message = "Test ";
            message += testMethod.getName() + " started.";
            ReporterNG.logBusiness(message);
            ReporterNG.setAttribute(TestBase.ATTRIBUTES.ATTRIBUTE_NAME.toString(), "_" + id++);
        }
        ReporterNG.LOG.info("Processing Test " + iInvokedMethod.toString());
    }
    TestBase.setPassed();
}
 
開發者ID:ggasoftware,項目名稱:gga-selenium-framework,代碼行數:17,代碼來源:InvokedMethodListener.java

示例10: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod method, ITestResult result) {
    Throwable throwable = result.getThrowable();
    if (throwable != null) {
        TestBase.setFailed(throwable.getMessage());
    }
    super.afterInvocation(method, result);
    if (method.isTestMethod()) {
        if (!TestBase.getPassed()) {
            logBusinessScreenshot("Error Occurred!");
        } else {
            if (TestBaseWebDriver.takePassedScreenshot) {
                logBusinessScreenshot("Test Passed");
            }
        }
    }
}
 
開發者ID:ggasoftware,項目名稱:gga-selenium-framework,代碼行數:18,代碼來源:WebDriverInvokedMethodListener.java

示例11: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
@CheckReturnValue
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) {
    if (method.isTestMethod()) {
        final String fileName = String.format("http://localhost:4444/video/%s.mp4",
                testResult.getAttribute("sessionId"));
        attachUri("Video", fileName);
    }
}
 
開發者ID:sskorol,項目名稱:qaa-amazon,代碼行數:10,代碼來源:VideoRecordingListener.java

示例12: beforeInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
    if (method.getTestMethod().isBeforeMethodConfiguration()) {
        beforeMethodBefore = true;
    } else if (method.isTestMethod()) {
        testMethodBefore = true;
    } else if (method.getTestMethod().isAfterMethodConfiguration()) {
        afterMethodBefore = true;
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:11,代碼來源:MethodListenerExtension.java

示例13: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
    if (method.getTestMethod().isBeforeMethodConfiguration()) {
        beforeMethodAfter = true;
    } else if (method.isTestMethod()) {
        testMethodAfter = true;
    } else if (method.getTestMethod().isAfterMethodConfiguration()) {
        afterMethodAfter = true;
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:11,代碼來源:MethodListenerExtension.java

示例14: beforeInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
    if (method.getTestMethod().isBeforeMethodConfiguration()) {
        beforeMethodBefore.add(testResult.getName());
    } else if (method.isTestMethod()) {
        testMethodBefore.add(testResult.getName());
    } else if (method.getTestMethod().isAfterMethodConfiguration()) {
        afterMethodBefore.add(testResult.getName());
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:11,代碼來源:ChainedListener.java

示例15: afterInvocation

import org.testng.IInvokedMethod; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
    if (method.getTestMethod().isBeforeMethodConfiguration()) {
        beforeMethodAfter.add(testResult.getName());
    } else if (method.isTestMethod()) {
        testMethodAfter.add(testResult.getName());
    } else if (method.getTestMethod().isAfterMethodConfiguration()) {
        afterMethodAfter.add(testResult.getName());
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:11,代碼來源:ChainedListener.java


注:本文中的org.testng.IInvokedMethod.isTestMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。