本文整理匯總了Java中org.testng.ITestResult.getStartMillis方法的典型用法代碼示例。如果您正苦於以下問題:Java ITestResult.getStartMillis方法的具體用法?Java ITestResult.getStartMillis怎麽用?Java ITestResult.getStartMillis使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.testng.ITestResult
的用法示例。
在下文中一共展示了ITestResult.getStartMillis方法的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);
}
示例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();
}
示例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();
}
示例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();
}
示例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.");
}
示例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();
}
示例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 + " — " + 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);
}
}
}