当前位置: 首页>>代码示例>>Java>>正文


Java ITestResult.getEndMillis方法代码示例

本文整理汇总了Java中org.testng.ITestResult.getEndMillis方法的典型用法代码示例。如果您正苦于以下问题:Java ITestResult.getEndMillis方法的具体用法?Java ITestResult.getEndMillis怎么用?Java ITestResult.getEndMillis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.testng.ITestResult的用法示例。


在下文中一共展示了ITestResult.getEndMillis方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMethodExecutionTime

import org.testng.ITestResult; //导入方法依赖的package包/类
public Long getMethodExecutionTime(String testName, String methodName)
{
    long startTime = Long.MAX_VALUE;
    long endTime = Long.MIN_VALUE;

    Iterator<ITestResult> it2 = getMethodResults(testName, methodName).iterator();

    while (it2.hasNext())
    {
        ITestResult result = it2.next();

        startTime = result.getStartMillis();
        endTime = result.getEndMillis();

        break;
    }

    return (endTime - startTime);
}
 
开发者ID:pradeeptaswain,项目名称:oldmonk,代码行数:20,代码来源:ReporterAPI.java

示例2: onTestSuccess

import org.testng.ITestResult; //导入方法依赖的package包/类
public void onTestSuccess(ITestResult result)
{
    long timeTaken = result.getEndMillis() - result.getStartMillis();
    timeTakenByTestMethods += timeTaken;
    System.err.println("TestMethod Passed : " + getTestMethodNameFromResult(result) + " time taken : " + timeTaken);
    allPassedTestMethods.add(getTestMethodNameFromResult(result));
    progressingTestMethods.remove(getTestMethodNameFromResult(result));
    try
    {
        testsPending.remove(getTestMethodNameFromResult(result));
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    update();
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:17,代码来源:ProgressReporter.java

示例3: onTestFailure

import org.testng.ITestResult; //导入方法依赖的package包/类
public void onTestFailure(ITestResult result)
{
    long timeTaken = result.getEndMillis() - result.getStartMillis();
    timeTakenByTestMethods += timeTaken;
    System.err.println("TestMethod Passed : " + getTestMethodNameFromResult(result) + " time taken : " + timeTaken);
    allFailedTestMethods.add(getTestMethodNameFromResult(result));
    progressingTestMethods.remove(getTestMethodNameFromResult(result));
    try
    {
        testsPending.remove(getTestMethodNameFromResult(result));
    } catch (Exception e)
    {
        e.printStackTrace();
    }

    if (allFailed.containsKey(result.getThrowable().getMessage()))
    {
        allFailed.put(result.getThrowable().getMessage(), allFailed.get(result) + "<br>" + getTestMethodNameFromResult(result));
    } else
    {
        allFailed.put(result.getThrowable().getMessage(), getTestMethodNameFromResult(result));
    }
    update();
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:25,代码来源:ProgressReporter.java

示例4: setFailedTcAttribute

import org.testng.ITestResult; //导入方法依赖的package包/类
private void setFailedTcAttribute(XMLStringBuffer doc, ITestResult failedTestCase) {
    Properties attributesFailedTestSuites = new Properties();
    String tcName = ((HashMap<String, String>) failedTestCase.getParameters()[0]).get(PROP_TEST_ID);
    attributesFailedTestSuites.setProperty(XMLConstants.ATTR_NAME, tcName);
    long elapsedTimeMillis = failedTestCase.getEndMillis() - failedTestCase.getStartMillis();
    testRunningTotalTime += elapsedTimeMillis;
    Throwable t = failedTestCase.getThrowable();
    doc.push(XMLConstants.TESTCASE, attributesFailedTestSuites);
    if (t != null) {
        attributesFailedTestSuites.setProperty(XMLConstants.ATTR_TYPE, t.getClass().getName());
        String message = t.getMessage();
        if ((message != null) && (message.length() > 0)) {
            attributesFailedTestSuites.setProperty(XMLConstants.ATTR_MESSAGE, encodeAttr(message)); // ENCODE
        }
        doc.push(XMLConstants.FAILURE, attributesFailedTestSuites);
        doc.addCDATA(Utils.stackTrace(t, false)[0]);
        doc.pop();
    } else {
        doc.addEmptyElement(XMLConstants.FAILURE); // THIS IS AN ERROR
    }
    doc.pop();
}
 
开发者ID:HotelsDotCom,项目名称:heat,代码行数:23,代码来源:CustomJUnitReportListener.java

示例5: getRunTime

import org.testng.ITestResult; //导入方法依赖的package包/类
/**
 * Gets run time.
 *
 * @param testResult the test result
 */
@AfterMethod
public void getRunTime(final ITestResult testResult) {
  final long time = testResult.getEndMillis() - testResult.getStartMillis();
  log.info("Iteration #" + testResult.getMethod().getCurrentInvocationCount()
      + " on " + POINTS + " measurements ran in " + time + "ms. "
      + (time / ((double) POINTS)) + "ms per measurement.");
}
 
开发者ID:delta-leonis,项目名称:algieba,代码行数:13,代码来源:PSDControllerConvergenceTest.java

示例6: onTestFailedButWithinSuccessPercentage

import org.testng.ITestResult; //导入方法依赖的package包/类
public void onTestFailedButWithinSuccessPercentage(ITestResult result)
{
    long timeTaken = result.getEndMillis() - result.getStartMillis();
    timeTakenByTestMethods += timeTaken;
    System.err.println("TestMethod failed withing Success% : " + result.getTestClass().getName() + "." + result.getMethod().getMethodName());
    testsPending.remove(getTestMethodNameFromResult(result));
    update();
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:9,代码来源:ProgressReporter.java

示例7: resultSummary

import org.testng.ITestResult; //导入方法依赖的package包/类
/**
 * @param tests
 */
private void resultSummary(IResultMap tests, String testname, String style, String details)
{
    if (tests.getAllResults().size() > 0)
    {
        StringBuffer buff = new StringBuffer();
        String lastClassName = "";
        int mq = 0;
        int cq = 0;
        for (ITestNGMethod method : getMethodSet(tests))
        {
            m_row += 1;
            m_methodIndex += 1;
            ITestClass testClass = method.getTestClass();
            String className = testClass.getName();
            if (mq == 0)
            {
                titleRow(testname + " &#8212; " + style + details, 4);
            }
            if (!className.equalsIgnoreCase(lastClassName))
            {
                if (mq > 0)
                {
                    cq += 1;
                    m_out.println("<tr class=\"" + style
                            + (cq % 2 == 0 ? "even" : "odd") + "\">" + "<td rowspan=\""
                            + mq + "\">" + lastClassName + buff);
                }
                mq = 0;
                buff.setLength(0);
                lastClassName = className;
            }
            Set<ITestResult> resultSet = tests.getResults(method);
            long end = Long.MIN_VALUE;
            long start = Long.MAX_VALUE;
            for (ITestResult testResult : tests.getResults(method))
            {
                if (testResult.getEndMillis() > end)
                {
                    end = testResult.getEndMillis();
                }
                if (testResult.getStartMillis() < start)
                {
                    start = testResult.getStartMillis();
                }
            }
            mq += 1;
            if (mq > 1)
            {
                buff.append("<tr class=\"" + style + (cq % 2 == 0 ? "odd" : "even")
                        + "\">");
            }
            String description = method.getDescription();
            String testInstanceName = resultSet.toArray(new ITestResult[]{})[0].getTestName();
            buff.append("<td><a href=\"#m" + m_methodIndex + "\">"
                    + qualifiedName(method)
                    + " " + (description != null && description.length() > 0
                    ? "(\"" + description + "\")"
                    : "")
                    + "</a>" + (null == testInstanceName ? "" : "<br>(" + testInstanceName + ")")
                    + "</td>" + "<td class=\"numi\">"
                    + resultSet.size() + "</td><td class=\"numi\">" + (end - start)
                    + "</td></tr>");
        }
        if (mq > 0)
        {
            cq += 1;
            m_out.println("<tr class=\"" + style + (cq % 2 == 0 ? "even" : "odd")
                    + "\">" + "<td rowspan=\"" + mq + "\">" + lastClassName + buff);
        }
    }
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:75,代码来源:EmailableReporter.java


注:本文中的org.testng.ITestResult.getEndMillis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。