本文整理汇总了Java中org.testng.IResultMap类的典型用法代码示例。如果您正苦于以下问题:Java IResultMap类的具体用法?Java IResultMap怎么用?Java IResultMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IResultMap类属于org.testng包,在下文中一共展示了IResultMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateReport
import org.testng.IResultMap; //导入依赖的package包/类
@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
List<ITestResult> list = new ArrayList<ITestResult>();
for (ISuite suite : suites) {
Map<String, ISuiteResult> suiteResults = suite.getResults();
for (ISuiteResult suiteResult : suiteResults.values()) {
ITestContext testContext = suiteResult.getTestContext();
IResultMap passedTests = testContext.getPassedTests();
IResultMap failedTests = testContext.getFailedTests();
IResultMap skippedTests = testContext.getSkippedTests();
IResultMap failedConfig = testContext.getFailedConfigurations();
list.addAll(this.listTestResult(passedTests));
list.addAll(this.listTestResult(failedTests));
list.addAll(this.listTestResult(skippedTests));
list.addAll(this.listTestResult(failedConfig));
}
}
this.sort(list);
this.outputResult(list, outputDirectory+"/test.txt");
}
示例2: testFinishHasFailedTests
import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasFailedTests() {
IResultMap failedTests = mock(IResultMap.class);
ResultMap empty = new ResultMap();
when(testContext.getFailedConfigurations()).thenReturn(empty);
when(testContext.getSkippedTests()).thenReturn(empty);
when(testContext.getSkippedConfigurations()).thenReturn(empty);
when(failedTests.size()).thenReturn(1);
when(testContext.getFailedTests()).thenReturn(failedTests);
FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
示例3: testFinishHasFailedConfigurations
import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasFailedConfigurations() {
IResultMap failedConfigurations = mock(IResultMap.class);
ResultMap empty = new ResultMap();
when(testContext.getFailedTests()).thenReturn(empty);
when(testContext.getSkippedTests()).thenReturn(empty);
when(testContext.getSkippedConfigurations()).thenReturn(empty);
when(failedConfigurations.size()).thenReturn(1);
when(testContext.getFailedConfigurations()).thenReturn(failedConfigurations);
FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
示例4: testFinishHasSkippedTest
import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasSkippedTest() {
IResultMap skippedTests = mock(IResultMap.class);
ResultMap empty = new ResultMap();
when(testContext.getFailedTests()).thenReturn(empty);
when(testContext.getFailedConfigurations()).thenReturn(empty);
when(testContext.getSkippedConfigurations()).thenReturn(empty);
when(skippedTests.size()).thenReturn(1);
when(testContext.getSkippedTests()).thenReturn(skippedTests);
FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
示例5: testFinishHasSkippedConfigurationsTest
import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishHasSkippedConfigurationsTest() {
IResultMap skippedConfigurations = mock(IResultMap.class);
ResultMap empty = new ResultMap();
when(testContext.getFailedTests()).thenReturn(empty);
when(testContext.getFailedConfigurations()).thenReturn(empty);
when(testContext.getSkippedTests()).thenReturn(empty);
when(skippedConfigurations.size()).thenReturn(1);
when(testContext.getSkippedConfigurations()).thenReturn(skippedConfigurations);
FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
}
示例6: onFinish
import org.testng.IResultMap; //导入依赖的package包/类
@Override
public void onFinish(ITestContext context) {
final ISuite suite = context.getSuite();
final String suiteName = suite == null ? "[UNKNOWN]" : suite.getName();
final IResultMap passed = context.getPassedTests();
final IResultMap failed = context.getFailedTests();
final IResultMap skipped = context.getSkippedTests();
final int passedCount = passed == null ? -1 : passed.size();
final int failedCount = failed == null ? -1 : failed.size();
final int skippedCount = skipped == null ? -1 : skipped.size();
Log.i(TAG, "Finished test run \"" + suiteName + "\" with "
+ passedCount + " successful tests, "
+ failedCount + " failures and "
+ skippedCount + " tests skipped");
}
示例7: addAllTestResults
import org.testng.IResultMap; //导入依赖的package包/类
private void addAllTestResults(Set<ITestResult> testResults, IResultMap resultMap) {
if (resultMap != null) {
// Sort the results chronologically before adding them
List<ITestResult> allResults = new ArrayList<ITestResult>();
allResults.addAll(resultMap.getAllResults());
Collections.sort(new ArrayList<>(allResults), new Comparator<ITestResult>() {
@Override
public int compare(ITestResult o1, ITestResult o2) {
return (int) (o1.getStartMillis() - o2.getStartMillis());
}
});
testResults.addAll(allResults);
}
}
示例8: resultDetail
import org.testng.IResultMap; //导入依赖的package包/类
private void resultDetail(IResultMap tests) {
for (ITestResult result : tests.getAllResults()) {
ITestNGMethod method = result.getMethod();
int methodId = getId(result);
String cname = method.getTestClass().getName();
m_out.println("<h2 id=\"m" + methodId + "\" name=\"m" + methodId + "\" >" + cname + ":"
+ method.getMethodName() + "</h2>");
Set<ITestResult> resultSet = tests.getResults(method);
generateForResult(result, method, resultSet.size());
m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>");
}
}
示例9: getAllTestIds
import org.testng.IResultMap; //导入依赖的package包/类
/**
* 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);
}
}
}
示例10: getMethodSet
import org.testng.IResultMap; //导入依赖的package包/类
/**
* @param tests
* @return
*/
private Collection<ITestNGMethod> getMethodSet(IResultMap tests)
{
Set r = new TreeSet<ITestNGMethod>(new TestSorter<ITestNGMethod>());
r.addAll(tests.getAllMethods());
return r;
}
示例11: generateReport
import org.testng.IResultMap; //导入依赖的package包/类
@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory)
{
List<ITestResult> list = new ArrayList<ITestResult>();
for (ISuite suite : suites) {
Map<String, ISuiteResult> suiteResults = suite.getResults();
for (ISuiteResult suiteResult : suiteResults.values()) {
ITestContext testContext = suiteResult.getTestContext();
IResultMap passedTests = testContext.getPassedTests();
IResultMap failedTests = testContext.getFailedTests();
IResultMap skippedTests = testContext.getSkippedTests();
IResultMap failedConfig = testContext.getFailedConfigurations();
list.addAll(this.listTestResult(passedTests));
list.addAll(this.listTestResult(failedTests));
list.addAll(this.listTestResult(skippedTests));
//list.addAll(this.listTestResult(failedConfig));
}
}
CopyReportResources reportReource=new CopyReportResources();
try {
reportReource.copyResources();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
this.sort(list);
this.outputResult(list, outputDirectory+"/report.html");
}
示例12: testFinishSuiteFailed
import org.testng.IResultMap; //导入依赖的package包/类
@Test
public void testFinishSuiteFailed() {
ISuiteResult suiteResult = mock(ISuiteResult.class);
Map<String, ISuiteResult> suiteResults = new HashMap<String, ISuiteResult>(1);
suiteResults.put("", suiteResult);
IResultMap resultMap = mock(ResultMap.class);
when(iSuite.getResults()).thenReturn(suiteResults);
when(suiteResult.getTestContext()).thenReturn(testContext);
when(testContext.getFailedTests()).thenReturn(resultMap);
when(resultMap.size()).thenReturn(1);
FinishTestItemRQ rq = testNGService.buildFinishTestSuiteRq(iSuite);
assertThat(rq.getStatus(), is(Statuses.FAILED));
}
示例13: resultDetail
import org.testng.IResultMap; //导入依赖的package包/类
private void resultDetail(IResultMap tests) {
for (ITestResult result : tests.getAllResults()) {
ITestNGMethod method = result.getMethod();
int methodId = getId(result);
String cname = method.getTestClass().getName();
m_out.println("<h2 id=\"m" + methodId + "\" name=\"m" + methodId + "\" >" + cname + ":" + method.getMethodName() + "</h2>");
Set<ITestResult> resultSet = tests.getResults(method);
generateForResult(result, method, resultSet.size());
m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>");
}
}
示例14: getAllTestIds
import org.testng.IResultMap; //导入依赖的package包/类
/**
* 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);
}
}
}
示例15: hasFailedBefore
import org.testng.IResultMap; //导入依赖的package包/类
private boolean hasFailedBefore(IResultMap failureList, ITestResult passedResult) {
for (ITestResult result : failureList.getAllResults()) {
String failedTest =
result.getMethod().getRealClass().toString()+ "." + result.getMethod().getMethodName();
String passedTest = passedResult.getMethod().getRealClass().toString() + "." +
passedResult.getMethod().getMethodName();
if (failedTest.equals(passedTest) && methodParameterEqual(result, passedResult)) {
return true;
}
}
return false;
}