Java 类org.testng.ITestContext 实例源码

项目:sunshine    文件:TestNGStatus.java   
private void calculate() {
    if (!this.counts.isEmpty()) return;
    int passed = 0;
    int failed = 0;
    int skipped = 0;

    for (ISuite suite : this.reports) {
        for (ISuiteResult result : suite.getResults().values()) {
            final ITestContext testContext = result.getTestContext();
            passed += testContext.getPassedTests().size();
            failed += testContext.getFailedTests().size();
            skipped += testContext.getSkippedTests().size();
        }
    }
    this.counts.add(0, passed + failed + skipped);
    this.counts.add(1, failed);
    this.counts.add(2, skipped);
}
项目:teasy    文件:MethodsInvoker.java   
protected TestClassContext(Class testClass, AbstractTest testInstance, Class<? extends Annotation> annotationClassToInvokeMethods, ITestContext testContext) {
    this.testClass = testClass;
    this.testInstance = testInstance;
    this.annotationClassToInvokeMethods = annotationClassToInvokeMethods;
    if (testContext.getExcludedGroups() == null) {
        this.excludedGroups = new String[0];
    } else {
        this.excludedGroups = Arrays.copyOf(testContext.getExcludedGroups(), testContext.getExcludedGroups().length);
    }
    if (testContext.getIncludedGroups() == null) {
        this.includedGroups = new String[0];
    } else {
        this.includedGroups = Arrays.copyOf(testContext.getIncludedGroups(), testContext.getIncludedGroups().length);
    }
    this.testContext = testContext;
}
项目:DolphinNG    文件:EmailableReporter.java   
/**
 * Creates a section showing known results for each method
 */
protected void generateMethodDetailReport(List<ISuite> suites)
{
    m_methodIndex = 0;
    for (ISuite suite : suites)
    {
        Map<String, ISuiteResult> r = suite.getResults();
        for (ISuiteResult r2 : r.values())
        {
            ITestContext testContext = r2.getTestContext();
            if (r.values().size() > 0)
            {
                m_out.println("<h1>" + testContext.getName() + "</h1>");
            }
            resultDetail(testContext.getFailedConfigurations(), "failed");
            resultDetail(testContext.getFailedTests(), "failed");
            resultDetail(testContext.getSkippedConfigurations(), "skipped");
            resultDetail(testContext.getSkippedTests(), "skipped");
            resultDetail(testContext.getPassedTests(), "passed");
        }
    }
}
项目:allure-java    文件:AllureTestNg.java   
@Override
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult,
                            final ITestContext context) {
    final ITestNGMethod testMethod = method.getTestMethod();
    if (isSupportedConfigurationFixture(testMethod)) {
        final String executableUuid = currentExecutable.get();
        currentExecutable.remove();
        if (testResult.isSuccess()) {
            getLifecycle().updateFixture(executableUuid, result -> result.withStatus(Status.PASSED));
        } else {
            getLifecycle().updateFixture(executableUuid, result -> result
                    .withStatus(getStatus(testResult.getThrowable()))
                    .withStatusDetails(getStatusDetails(testResult.getThrowable()).orElse(null)));
        }
        getLifecycle().stopFixture(executableUuid);

        if (testMethod.isBeforeMethodConfiguration() || testMethod.isAfterMethodConfiguration()) {
            final String containerUuid = currentTestContainer.get();
            validateContainerExists(getQualifiedName(testMethod), containerUuid);
            currentTestContainer.remove();
            getLifecycle().stopTestContainer(containerUuid);
            getLifecycle().writeTestContainer(containerUuid);
        }
    }
}
项目:WebAndAppUITesting    文件:PowerEmailableReporter.java   
/** Creates a section showing known results for each method */
protected void generateMethodDetailReport(List<ISuite> suites) {
    for (ISuite suite : suites) {
        Map<String, ISuiteResult> r = suite.getResults();
        for (ISuiteResult r2 : r.values()) {
            ITestContext testContext = r2.getTestContext();
            if (r.values().size() > 0) {
                m_out.println("<h1>" + testContext.getName() + "</h1>");
            }
            resultDetail(testContext.getFailedConfigurations());
            resultDetail(testContext.getFailedTests());
            resultDetail(testContext.getSkippedConfigurations());
            resultDetail(testContext.getSkippedTests());
            resultDetail(testContext.getPassedTests());
        }
    }
}
项目:TestNG-Foundation    文件:ListenerChain.java   
/**
 * [ITestListener]
 * Invoked each time a test is skipped.
 *
 * @param result {@code ITestResult} containing information about the run test
 * @see ITestResult#SKIP
 */
@Override
public void onTestSkipped(ITestResult result) {

    // >>>>> ENTER workaround for TestNG bug
    // https://github.com/cbeust/testng/issues/1602
    ITestContext context = result.getTestContext();
    IInvokedMethod method = new InvokedMethod(
                    result.getTestClass(), result.getMethod(), System.currentTimeMillis(), result);

    beforeInvocation(method, result, context);
    // <<<<< LEAVE workaround for TestNG bug

    synchronized (testListeners) {
        for (ITestListener testListener : testListeners) {
            testListener.onTestSkipped(result);
        }
    }
}
项目:datarouter    文件:ModuleFactory.java   
@Override
public Module createModule(ITestContext context, Class<?> testClass){

    Module globalModule = new AbstractModule(){

        @Override
        protected void configure(){
            for(Module module : modules){
                install(module);
            }
        }

    };
    Iterable<? extends Module> overriders = getOverriders();
    return Modules.override(globalModule).with(overriders);
}
项目:Equella    文件:AbstractRestAssuredTest.java   
@AfterSuite
public void cleanupAfterSuite(ITestContext context)
{
    if( suite != null )
    {
        @SuppressWarnings("unchecked")
        List<CleanupAfter> cleanups = (List<CleanupAfter>) suite.getAttribute("cleanups");
        if( cleanups != null )
        {
            ListIterator<CleanupAfter> listIterator = cleanups.listIterator(cleanups.size());
            while( listIterator.hasPrevious() )
            {
                CleanupAfter cleanup = listIterator.previous();
                if( cleanup != null )
                {
                    cleanup.cleanUp();
                }
            }
        }
    }
}
项目:Equella    文件:AbstractTest.java   
@BeforeClass(alwaysRun = true)
public void setupContext(ITestContext testContext)
{
    this.suite = testContext.getSuite();
    File rootFolder = testConfig.getTestFolder();
    String contextUrl;

    if( isInstitutional() )
    {
        contextUrl = testConfig.getInstitutionUrlFromShortName(rootFolder.getName());
    }
    else
    {
        contextUrl = testConfig.getAdminUrl();
    }

    context = new PageContext(testConfig, contextUrl);
    context.setIntegUrl(testConfig.getIntegrationUrl(rootFolder.getName()));
    context.setNamePrefix(getNamePrefix());
    customisePageContext();
}
项目:oldmonk    文件:ReporterAPI.java   
public int getTotalPassedMethodsForSuite()
{
    int totalNumberOfPassedMethodsForSuite = 0;

    ITestContext overview = null;

    for (ISuite suite : suites)
    {
        Map<String, ISuiteResult> tests = suite.getResults();

        for (ISuiteResult r : tests.values())
        {
            overview = r.getTestContext();

            totalNumberOfPassedMethodsForSuite += overview.getPassedTests().getAllMethods().size();
        }
    }

    return totalNumberOfPassedMethodsForSuite;
}
项目:oldmonk    文件:ReporterAPI.java   
public int getTotalSkippedMethodsForSuite()
{
    int totalNumberOfSkippedMethodsForSuite = 0;

    ITestContext overview = null;

    for (ISuite suite : suites)
    {
        Map<String, ISuiteResult> tests = suite.getResults();

        for (ISuiteResult r : tests.values())
        {
            overview = r.getTestContext();

            totalNumberOfSkippedMethodsForSuite += overview.getSkippedTests().getAllMethods().size();
        }
    }

    return totalNumberOfSkippedMethodsForSuite;
}
项目:oldmonk    文件:ReporterAPI.java   
public int getTotalFailedMethodsForTest(String testName)
{
    int totalNumberOfFailedMethodsForTest = 0;

    ITestContext overview = null;

    for (ISuite suite : suites)
    {
        suiteName = suite.getName();

        Map<String, ISuiteResult> tests = suite.getResults();

        for (ISuiteResult r : tests.values())
        {
            overview = r.getTestContext();

            if (testName.equalsIgnoreCase(overview.getName()))
            {
                totalNumberOfFailedMethodsForTest = overview.getFailedTests().getAllMethods().size();
                break;
            }
        }
    }

    return totalNumberOfFailedMethodsForTest;
}
项目:oldmonk    文件:ReporterAPI.java   
public Map<String, String> getAllParametersForTest(String testName)
{
    ITestContext overview = null;

    for (ISuite suite : suites)
    {
        Map<String, ISuiteResult> tests = suite.getResults();

        for (ISuiteResult r : tests.values())
        {
            overview = r.getTestContext();

            if (testName.equalsIgnoreCase(overview.getName()))
            {
                return overview.getCurrentXmlTest().getAllParameters();
            }
        }
    }

    return null;
}
项目:oldmonk    文件:ReporterAPI.java   
public ITestNGMethod[] getAllMethodsForTest(String testName)
{
    ITestContext overview = null;

    for (ISuite suite : suites)
    {
        suiteName = suite.getName();

        Map<String, ISuiteResult> tests = suite.getResults();

        for (ISuiteResult r : tests.values())
        {
            overview = r.getTestContext();

            if (overview.getName().equalsIgnoreCase(testName))
            {
                return overview.getAllTestMethods();
            }
        }
    }

    return null;
}
项目:openjdk-jdk10    文件:TestReorderInterceptor.java   
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
项目:DolphinNG    文件:ProgressReporter.java   
public void onFinish(ITestContext context)
{
    System.err.println("TEST finished : " + context.getName());
    testsCompleted.add(context.getName());
    testsInProgress.remove(context.getName());

    totalActualTimeTaken = context.getEndDate().getTime() - context.getStartDate().getTime();
    long timeSaved = timeTakenByTestMethods - totalActualTimeTaken;
    customMessage.replace(0, customMessage.length(), "");
    if (timeTakenByTestMethods < 1)
    {
        timeTakenByTestMethods = 1;
    }
    customMessage.append("<span> " + "Sum of time taken for each test method : " + timeTakenByTestMethods / 1000 + " seconds!" + "</span><br/>" +
            "<span> " + "Actual total time taken for run : " + totalActualTimeTaken / 1000 + " seconds!" + "</span><br/>" +
            "<span>" + "Time saved : " + timeSaved / 1000 + " seconds OR " + timeSaved * 100 / timeTakenByTestMethods + "%</span>");
    update();
    lastUpdate = false;
}
项目:Reer    文件:TestNGTestClassProcessor.java   
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
    ISuite suite = context.getSuite();
    List<IMethodInstance> filtered = new LinkedList<IMethodInstance>();
    for (IMethodInstance candidate : methods) {
        if (matcher.matchesTest(candidate.getMethod().getTestClass().getName(), candidate.getMethod().getMethodName())
            || matcher.matchesTest(suite.getName(), null)) {
            filtered.add(candidate);
        }
    }
    return filtered;
}
项目:teasy    文件:AbstractSeleniumTest.java   
@BeforeSuite(alwaysRun = true)
public void beforeSuite(final ITestContext context) {
    if (methodsInvoker == null) {
        new SeleniumMethodsInvoker().invokeSuiteMethodsByAnnotation(OurBeforeSuite.class, context);
    } else {
        methodsInvoker.invokeSuiteMethodsByAnnotation(OurBeforeSuite.class, context);
    }
}
项目:teasy    文件:AbstractSeleniumTest.java   
@BeforeMethod(alwaysRun = true)
public void beforeMethod(final Method test, final Object[] params, final ITestContext context) {
    testName = TestUtils.getTestName(test);
    postponeFailureEvent.subscribe(new ScreenshotOnPostponeFailureSubscriber(testName));
    postponeFailureEvent.subscribe(new StorePostponeFailureSubscriber(context, testName));
    passCounter = 0;
}
项目:teasy    文件:AbstractSeleniumTest.java   
@AfterSuite(alwaysRun = true)
public void afterSuite(final ITestContext context) {
    if (methodsInvoker == null) {
        new SeleniumMethodsInvoker().invokeSuiteMethodsByAnnotation(OurAfterSuite.class, context);
    } else {
        methodsInvoker.invokeSuiteMethodsByAnnotation(OurAfterSuite.class, context);
    }
}
项目:heat    文件:CustomTestNgListener.java   
@Override
public void onStart(ITestContext testContext) {
    String testName = testContext.getCurrentXmlTest().getName();
    MDC.put("testName", testName);
    List<ITestResult> localSkippedTests = new ArrayList<>();
    testContext.setAttribute("skippedTestCases", localSkippedTests);
}
项目:teasy    文件:AbstractWebServiceTest.java   
@AfterSuite(alwaysRun = true)
public void afterSuite(final ITestContext context) {
    if (methodsInvoker == null) {
        new WebServiceMethodsInvoker().invokeSuiteMethodsByAnnotation(OurAfterSuite.class, context);
    } else {
        methodsInvoker.invokeSuiteMethodsByAnnotation(OurAfterSuite.class, context);
    }
}
项目:teasy    文件:AbstractWebServiceTest.java   
@BeforeGroups
public void doBeforeGroups(final ITestContext context) {
    if (methodsInvoker == null) {
        new WebServiceMethodsInvoker().invokeGroupMethodsByAnnotation(OurBeforeGroups.class, context);
    } else {
        methodsInvoker.invokeGroupMethodsByAnnotation(OurBeforeGroups.class, context);
    }
}
项目:teasy    文件:AbstractWebServiceTest.java   
@AfterGroups
public void doAfterGroups(final ITestContext context) {
    if (methodsInvoker == null) {
        new WebServiceMethodsInvoker().invokeGroupMethodsByAnnotation(OurAfterGroups.class, context);
    } else {
        methodsInvoker.invokeGroupMethodsByAnnotation(OurAfterGroups.class, context);
    }
    ParamsHolder.clearForGroup();
}
项目:heat    文件:TestBaseRunner.java   
/**
 * Method that takes test suites parameters and sets some environment properties.
 * @param propFilePath path of the property file data
 * @param inputWebappName name of the service to test (optional parameter)
 * @param context testNG context
 */
@BeforeSuite
@Override
@Parameters(value = {ENV_PROP_FILE_PATH, WEBAPP_NAME})
public void beforeTestSuite(String propFilePath,
                            @Optional(NO_INPUT_WEBAPP_NAME) String inputWebappName,
                            ITestContext context) {
    TestSuiteHandler testSuiteHandler = TestSuiteHandler.getInstance();
    testSuiteHandler.setPropertyFilePath(propFilePath);
    testSuiteHandler.populateEnvironmentHandler();
    testSuiteHandler.populateTestCaseUtils();

}
项目:teasy    文件:WebServiceMethodsInvoker.java   
public <T extends Annotation> void invokeGroupMethodsByAnnotation(final Class<T> annotationClass, final ITestContext testContext) {
    final TestClassContext testClassContext = new TestClassContext(((TestRunner) testContext).getTest()
            .getXmlClasses()
            .get(0)
            .getSupportClass(), null, annotationClass, testContext);
    invokeMethodsByAnnotation(testClassContext, true);
}
项目:selenium-testng-template    文件:HtmlReporter.java   
private String buildReport(ITestContext test) {
    try {
        InputStream is = HtmlReporter.class.getResourceAsStream(REPORT_TEMPLATE);
        Configuration cfg = new Configuration(Configuration.getVersion());
        Template template = new Template("Report", new InputStreamReader(is), cfg);
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("context", test);
        StringWriter writer = new StringWriter();
        template.process(parameters, writer);
        return writer.toString();
    } catch (Exception e) {
        log.error("Build Report error", e);
        return "Exception: " + e.getMessage();
    }
}
项目:heat    文件:SingleMode.java   
/**
 * Method that takes test suites parameters and sets some environment properties.
 * @param propFilePath path of the property file data
 * @param inputWebappName name of the service to test (optional parameter)
 * @param context testNG context
 */
@BeforeSuite
@Override
@Parameters(value = {ENV_PROP_FILE_PATH, WEBAPP_NAME})
public void beforeTestSuite(String propFilePath,
                            @Optional(NO_INPUT_WEBAPP_NAME) String inputWebappName,
                            ITestContext context) {
    super.beforeTestSuite(propFilePath, inputWebappName, context);
    TestSuiteHandler.getInstance().setWebappName(inputWebappName);
}
项目:teasy    文件:ProcessPostponedFailureListener.java   
@Override
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult, final ITestContext context) {
    final String testName = getTestName(testResult);
    final Boolean isTestFailed = (Boolean) context.getAttribute(format("%s postpone fail", testName));
    final Boolean isBeforeGroupFailed = (Boolean) context.getAttribute(format("%s postpone fail", "E4BeforeGroups"));
    if ((isTestFailed != null && isTestFailed) || (isBeforeGroupFailed != null && isBeforeGroupFailed)) {
        testResult.setStatus(FAILURE);
        testResult.setThrowable(new PostponedFailureException(getErrorMessage(testName)));
    }
}
项目:allure-java    文件:AllureTestNg.java   
@Override
public void onStart(final ITestContext context) {
    final String parentUuid = getUniqueUuid(context.getSuite());
    final String uuid = getUniqueUuid(context);
    final TestResultContainer container = new TestResultContainer()
            .withUuid(uuid)
            .withName(context.getName())
            .withStart(System.currentTimeMillis());
    getLifecycle().startTestContainer(parentUuid, container);

    Stream.of(context.getAllTestMethods())
            .map(ITestNGMethod::getTestClass)
            .distinct()
            .forEach(this::onBeforeClass);
}
项目:allure-java    文件:AllureTestNg.java   
@Override
public void onFinish(final ITestContext context) {
    final String uuid = getUniqueUuid(context);
    getLifecycle().stopTestContainer(uuid);
    getLifecycle().writeTestContainer(uuid);

    Stream.of(context.getAllTestMethods())
            .map(ITestNGMethod::getTestClass)
            .distinct()
            .forEach(this::onAfterClass);
}
项目:allure-java    文件:AllureTestNg.java   
@Override
public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult,
                             final ITestContext context) {
    final ITestNGMethod testMethod = method.getTestMethod();
    if (isSupportedConfigurationFixture(testMethod)) {
        ifSuiteFixtureStarted(context.getSuite(), testMethod);
        ifTestFixtureStarted(context, testMethod);
        ifClassFixtureStarted(testMethod);
        ifMethodFixtureStarted(testMethod);
    }
}
项目:test-data-supplier    文件:DataSupplierMetaData.java   
public DataSupplierMetaData(final ITestContext context, final ITestNGMethod testMethod) {
    this.context = context;
    this.testMethod = testMethod;
    this.dataSupplierMethod = findDataSupplier();

    val dataSupplier = ofNullable(dataSupplierMethod.getDeclaredAnnotation(DataSupplier.class));
    this.transpose = dataSupplier.map(DataSupplier::transpose).orElse(false);
    this.flatMap = dataSupplier.map(DataSupplier::flatMap).orElse(false);
    this.indices = dataSupplier.map(DataSupplier::indices).orElse(new int[0]);
    this.testData = transform();
}
项目:WebAndAppUITesting    文件:PowerEmailableReporter.java   
/**
 * Get All tests id by class + method + parameters hash code.
 * 
 * @param context
 * @param suite
 */
private void getAllTestIds(ITestContext context, ISuite suite) {
    IResultMap passTests = context.getPassedTests();
    IResultMap failTests = context.getFailedTests();
    List<IInvokedMethod> invokedMethods = suite.getAllInvokedMethods();
    for (IInvokedMethod im : invokedMethods) {
        if (passTests.getAllMethods().contains(im.getTestMethod())
                || failTests.getAllMethods().contains(im.getTestMethod())) {
            int testId = getId(im.getTestResult());
            // m_out.println("ALLtestid=" + testId);
            allRunTestIds.add(testId);
        }
    }
}
项目:heat    文件:CustomTestNgListener.java   
/**
 * This method is invoked at the end of each test suite. Is useful to create console output logs, in terms of summary of the output
 * of the test suite just executed. In particular it prints the lists of success test cases, failing ones and skipped ones.
 * Data about the test case outputs are collected in 'onTestSuccess' and 'onTestFailure' methods.
 * @param testContext test context - testNG handling
 */
@Override
public void onFinish(ITestContext testContext) {
    String testName = testContext.getCurrentXmlTest().getName(); //test suite name
    int numTestSuccess = testContext.getPassedTests().size(); //number of successful test cases in the current test suite
    int numTestFailed = testContext.getFailedTests().size(); //number of failed test cases in the current test suite
    List<ITestResult> localSkippedTests = (List<ITestResult>) testContext.getAttribute("skippedTestCases");
    int numTestSkipped = localSkippedTests.size() + testContext.getSkippedTests().size(); //number of skipped test cases in the current test suite
    if (!localSkippedTests.isEmpty()) {
        numTestSuccess = numTestSuccess - numTestSkipped;
    }
    if (numTestSkipped > 0 && numTestSuccess == 0 && numTestFailed == 0) {
        // test suite totally skipped
        logger.trace("*************[{}][Suite description: {}] SKIPPED Test Suite", testName, testContext.getAttribute(TestBaseRunner.SUITE_DESCRIPTION_CTX_ATTR).toString());
        logger.info("*************[{}][{}] END Test Suite: Success: {} / Failed: {} / Skipped: {}",
            testName, testContext.getAttribute(TestBaseRunner.SUITE_DESCRIPTION_CTX_ATTR).toString(), numTestSuccess, numTestFailed, numTestSkipped);
    } else {
        logger.debug("*************[{}][{}] END Test Suite: Success: {} / Failed: {} / Skipped: {}",
            testName, testContext.getAttribute(TestBaseRunner.SUITE_DESCRIPTION_CTX_ATTR).toString(), numTestSuccess, numTestFailed, numTestSkipped);
    }

    if (numTestFailed > 0) {
        Iterator testFailedIterator = testContext.getFailedTests().getAllResults().iterator();
        while (testFailedIterator.hasNext()) {
            ITestResult singleResult = (ITestResult) testFailedIterator.next();
            logger.error("******* TC FAILED >> {}",
                    singleResult.getThrowable().getMessage());
        }
    }
}
项目:AutomationFrameworkTPG    文件:TestBase.java   
@AfterMethod(alwaysRun = true)
public void baseCleanup(ITestContext context, ITestResult result, Object[] params) throws IOException {
    if (params.length > 0 && params[0] instanceof WebDriverInstance){
        WebDriverInstance webDriverInstance = (WebDriverInstance)params[0];
        webDriverInstance.cleanup();
    }
    logTestResult(result);
    String tag = ThreadContext.get(THREAD_TAG);
    logger.info("Test is finished, removing the tag [{}]...", tag);
    ThreadContext.remove(THREAD_TAG);
    result.setAttribute(THREAD_TAG, tag);
}
项目:TestNG-Foundation    文件:ListenerChain.java   
/**
 * [ITestListener]
 * Invoked after the test class is instantiated and before
 * any configuration method is called.
 * 
 * @param context context for the test run
 */
@Override
public void onStart(ITestContext context) {
    synchronized (testListeners) {
        for (ITestListener testListener : Lists.reverse(testListeners)) {
            testListener.onStart(context);
        }
    }
}
项目:heat    文件:CustomJUnitReportListener.java   
private Properties setTestSuiteAttribute(Properties testSuiteAttr, String suiteName, ITestContext suiteContext) {
    Properties testSuiteAttributes = testSuiteAttr;
    int numFailures = getList(FAILED_TC, suiteContext).size();
    int numSuccess = getList(PASSED_TC, suiteContext).size();
    int numSkipped = getList(SKIPPED_TC, suiteContext).size();
    testSuiteAttributes.setProperty(XMLConstants.ATTR_NAME, suiteName);
    int tests = numFailures + numSuccess + numSkipped;
    if (tests == 0) {
        testSuiteAttributes.setProperty(PROP_STATUS, SKIPPED_STATUS);
    } else {
        testSuiteAttributes.setProperty(SUCCESS_STATUS, String.valueOf(numSuccess));
        testSuiteAttributes.setProperty(SKIPPED_STATUS, String.valueOf(numSkipped));
        int numberOfTests = numFailures + numSuccess + numSkipped;
        testSuiteAttributes.setProperty(XMLConstants.ATTR_TESTS, String.valueOf(numberOfTests));
        Date timeStamp = Calendar.getInstance().getTime();
        testSuiteAttributes.setProperty(XMLConstants.ATTR_FAILURES, String.valueOf(numFailures));
        testSuiteAttributes.setProperty(XMLConstants.ATTR_TIMESTAMP, timeStamp.toGMTString());
        if (numFailures > 0) {
            testSuiteAttributes.setProperty(PROP_STATUS, FAILED_STATUS);
        } else {
            testSuiteAttributes.setProperty(PROP_STATUS, SUCCESS_STATUS);
            numberOfPassedSuites += 1;
        }
    }

    return testSuiteAttributes;
}
项目:TestNG-Foundation    文件:ExecutionFlowController.java   
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
    // target platform support: filter out non-targeted methods
    // target platform support: set method target descriptions

    return methods;
}
项目:heat    文件:BasicMultipleChecks.java   
public BasicMultipleChecks(ITestContext context) {
    this.logUtils = TestSuiteHandler.getInstance().getLogUtils();
    this.context = context;
    this.steps = new TreeMap<>();
    this.paths = new HashMap<>();
    this.httpMethods = new HashMap<>();
}