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


Java ITestContext.getAllTestMethods方法代碼示例

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


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

示例1: getAllMethodsForTest

import org.testng.ITestContext; //導入方法依賴的package包/類
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;
}
 
開發者ID:pradeeptaswain,項目名稱:oldmonk,代碼行數:24,代碼來源:ReporterAPI.java

示例2: onStart

import org.testng.ITestContext; //導入方法依賴的package包/類
public void onStart(ITestContext context)
{
    System.err.println("TEST started : " + context.getName());
    testsInProgress.add(context.getName());
    ITestNGMethod[] allTestMethods = context.getAllTestMethods();
    for (ITestNGMethod m : allTestMethods)
    {
        String testMethod = m.getTestClass().getName() + "." + m.getMethodName();
        testsPending.add(testMethod);
    }
    update();
}
 
開發者ID:basavaraj1985,項目名稱:DolphinNG,代碼行數:13,代碼來源:ProgressReporter.java

示例3: getIncludedModulesForTest

import org.testng.ITestContext; //導入方法依賴的package包/類
public List<String> getIncludedModulesForTest(String testName)
{
    ITestContext overview = null;

    List<String> includedModules = new ArrayList<String>();
    String includedModule = "";
    String modulesCommaSeparated = config.getProperty("application.modules").replaceAll("\\s+", "");

    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))
            {
                String[] allDefinedModules = null;

                if (modulesCommaSeparated == null || modulesCommaSeparated.trim().length() == 0)
                {
                    Assert.fail("ERROR - Modules are not found in properties file");
                } else
                {
                    allDefinedModules = new String[modulesCommaSeparated.length()];
                    allDefinedModules = modulesCommaSeparated.split(",");
                }

                ITestNGMethod[] allTestMethods = overview.getAllTestMethods();

                for (ITestNGMethod testngMethod : allTestMethods)
                {
                    String[] modules = testngMethod.getGroups();
                    for (String module : modules)
                    {
                        for (String moduleName : allDefinedModules)
                        {
                            if (module.equalsIgnoreCase(moduleName))
                            {
                                if (!(includedModule.contains(module)))
                                {
                                    includedModules.add(module);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    return includedModules;
}
 
開發者ID:pradeeptaswain,項目名稱:oldmonk,代碼行數:57,代碼來源:ReporterAPI.java

示例4: getIncludedGroupsForTest

import org.testng.ITestContext; //導入方法依賴的package包/類
public List<String> getIncludedGroupsForTest(String testName)
{
    ITestContext overview = null;

    List<String> includedGroups = new ArrayList<String>();
    String includedGroup = "";
    String groupsCommaSeparated = config.getProperty("test.groups").replaceAll("\\s+", "");

    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))
            {

                String[] allDefinedGroups = null;

                if (groupsCommaSeparated == null || groupsCommaSeparated.trim().length() == 0)
                {
                    Assert.fail("ERROR - Test Groups are not found in properties file");
                } else
                {
                    allDefinedGroups = new String[groupsCommaSeparated.length()];
                    allDefinedGroups = groupsCommaSeparated.split(",");
                }

                ITestNGMethod[] allTestMethods = overview.getAllTestMethods();

                for (ITestNGMethod testngMethod : allTestMethods)
                {
                    String[] groups = testngMethod.getGroups();
                    for (String group : groups)
                    {
                        for (String groupName : allDefinedGroups)
                        {
                            if (group.equalsIgnoreCase(groupName))
                            {
                                if (!(includedGroup.contains(group)))
                                {
                                    includedGroups.add(group);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    return includedGroups;
}
 
開發者ID:pradeeptaswain,項目名稱:oldmonk,代碼行數:58,代碼來源:ReporterAPI.java

示例5: getMethodResults

import org.testng.ITestContext; //導入方法依賴的package包/類
public Set<ITestResult> getMethodResults(final String testName, final String methodName)
{
    ITestContext overview = null;

    Set<ITestResult> testResult = null;

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

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

            if (testName.equalsIgnoreCase(overview.getName()))
            {
                ITestNGMethod[] testMethods = overview.getAllTestMethods();
                for (ITestNGMethod method : testMethods)
                {
                    if (method.getMethodName().equalsIgnoreCase(methodName))
                    {
                        if (!(overview.getPassedTests().getResults(method).isEmpty()))
                        {
                            testResult = overview.getPassedTests().getResults(method);
                            break;
                        } else if (!(overview.getFailedTests().getResults(method).isEmpty()))
                        {
                            testResult = overview.getFailedTests().getResults(method);
                            break;
                        } else if (!(overview.getSkippedTests().getResults(method).isEmpty()))
                        {
                            testResult = overview.getSkippedTests().getResults(method);
                            break;
                        }
                    }
                }
            }
        }
    }

    return testResult;
}
 
開發者ID:pradeeptaswain,項目名稱:oldmonk,代碼行數:43,代碼來源:ReporterAPI.java

示例6: getTestFailureStackTrace

import org.testng.ITestContext; //導入方法依賴的package包/類
public String getTestFailureStackTrace(final String testName, final String methodName)
{
    ITestContext overview = null;

    Set<ITestResult> testResult = null;

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

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

            if (testName.equalsIgnoreCase(overview.getName()))
            {
                ITestNGMethod[] testMethods = overview.getAllTestMethods();
                for (ITestNGMethod method : testMethods)
                {
                    if (method.getMethodName().equalsIgnoreCase(methodName))
                    {
                        if (!(overview.getPassedTests().getResults(method).isEmpty()))
                        {
                            testResult = overview.getPassedTests().getResults(method);
                        } else if (!(overview.getFailedTests().getResults(method).isEmpty()))
                        {
                            testResult = overview.getFailedTests().getResults(method);
                        } else if (!(overview.getSkippedTests().getResults(method).isEmpty()))
                        {
                            testResult = overview.getSkippedTests().getResults(method);
                        }

                        Iterator<ITestResult> it2 = testResult.iterator();

                        while (it2.hasNext())
                        {
                            ITestResult result = it2.next();
                            return generateExceptionReport(result.getThrowable(), method);
                        }
                    }
                }
            }
        }
    }

    return null;
}
 
開發者ID:pradeeptaswain,項目名稱:oldmonk,代碼行數:48,代碼來源:ReporterAPI.java


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