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


Java ITestResult.getStatus方法代码示例

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


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

示例1: printError

import org.testng.ITestResult; //导入方法依赖的package包/类
@AfterMethod
public void printError(ITestResult result) {
    if (result.getStatus() == ITestResult.FAILURE) {
        String clsName = result.getTestClass().getName();
        clsName = clsName.substring(clsName.lastIndexOf(".") + 1);
        System.out.println("Test " + clsName + "." +
                           result.getName() + " FAILED");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:TestHarness.java

示例2: afterInvocation

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) {
    if (method.isTestMethod() && testResult.getStatus() == SUCCESS) {
        try {
            getSoftAssert().assertAll();
        } catch (AssertionError e) {
            testResult.getTestContext().getPassedTests().removeResult(testResult.getMethod());
            testResult.setStatus(TestResult.FAILURE);
            testResult.setThrowable(e);
        }
        THREAD_LOCAL_CONTAINER_FOR_SOFT_ASSERTIONS.remove();
    }
}
 
开发者ID:sskorol,项目名称:qaa-amazon,代码行数:14,代码来源:SoftAssertListener.java

示例3: getMethodExecutionStatus

import org.testng.ITestResult; //导入方法依赖的package包/类
public String getMethodExecutionStatus(String testName, String methodName)
{
    Iterator<ITestResult> it2 = getMethodResults(testName, methodName).iterator();

    String executionStatus = null;

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

        if (result.getStatus() == ITestResult.SUCCESS)
        {
            executionStatus = "PASS";
        } else if (result.getStatus() == ITestResult.FAILURE)
        {
            executionStatus = "FAIL";
        } else if (result.getStatus() == ITestResult.SKIP)
        {
            executionStatus = "SKIP";
        }

        break;
    }

    return executionStatus;
}
 
开发者ID:pradeeptaswain,项目名称:oldmonk,代码行数:27,代码来源:ReporterAPI.java

示例4: logTestResult

import org.testng.ITestResult; //导入方法依赖的package包/类
private void logTestResult(ITestResult result){
	String testResult;
	switch(result.getStatus()){
	case 1:
		testResult = "Passed";
		break;
	case 2:
		testResult = "Failed";
		break;
	case 3:
		testResult = "Skipped";
		break;
	default:
		testResult = "Success_Percentage_Failure";
	}

	StringBuilder sb = new StringBuilder();
	sb.append(String.format("Test result: %s%s", testResult, System.lineSeparator()));
	logger.info(sb.toString());
}
 
开发者ID:3pillarlabs,项目名称:AutomationFrameworkTPG,代码行数:21,代码来源:TestBase.java

示例5: handle

import org.testng.ITestResult; //导入方法依赖的package包/类
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
@Override
public void handle(final byte[] screenshot, final ITestResult testResult) {
    if (nonNull(screenshot) && testResult.getStatus() == FAILURE) {
        attachScreenshot(screenshot,
                testResult.getMethod().getMethodName() + "_" + LocalDate.now());
    }
}
 
开发者ID:sskorol,项目名称:qaa-amazon,代码行数:9,代码来源:ScreenShot.java

示例6: printCaseError

import org.testng.ITestResult; //导入方法依赖的package包/类
@AfterMethod
public void printCaseError(ITestResult result) {
    if (result.getStatus() == ITestResult.FAILURE) {
        Hierarchy hs = (Hierarchy)result.getParameters()[0];
        System.out.println("Separate compilation case " + hs);
        printCaseDetails(hs);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:FDSeparateCompilationTest.java

示例7: handle

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public void handle(final byte[] screenshot, final ITestResult testResult) {
    if (nonNull(screenshot) && screenshot.length > 0 && testResult.getStatus() == FAILURE) {
        SCREENSHOTS.putIfAbsent(screenshot, testResult);
    }
}
 
开发者ID:sskorol,项目名称:webdriver-supplier,代码行数:7,代码来源:MockScreenshotConsumer.java

示例8: generateForResult

import org.testng.ITestResult; //导入方法依赖的package包/类
private void generateForResult(ITestResult ans, ITestNGMethod method, int resultSetSize) {
	Object[] parameters = ans.getParameters();
	boolean hasParameters = parameters != null && parameters.length > 0;
	if (hasParameters) {
		tableStart("result", null);
		m_out.print("<tr class=\"param\">");
		for (int x = 1; x <= parameters.length; x++) {
			m_out.print("<th>Parameter #" + x + "</th>");
		}
		m_out.println("</tr>");
		m_out.print("<tr class=\"param stripe\">");
		for (Object p : parameters) {
			m_out.println("<td>" + Utils.escapeHtml(p.toString()) + "</td>");
		}
		m_out.println("</tr>");
	}
	List<String> msgs = Reporter.getOutput(ans);
	boolean hasReporterOutput = msgs.size() > 0;
	Throwable exception = ans.getThrowable();
	boolean hasThrowable = exception != null;
	if (hasReporterOutput || hasThrowable) {
		if (hasParameters) {
			m_out.print("<tr><td");
			if (parameters.length > 1) {
				m_out.print(" colspan=\"" + parameters.length + "\"");
			}
			m_out.println(">");
		} else {
			m_out.println("<div>");
		}
		if (hasReporterOutput) {
			if (hasThrowable) {
				m_out.println("<h3>Test Messages</h3>");
			}
			for (String line : msgs) {
				m_out.println(line + "<br/>");
			}
		}
		if (hasThrowable) {
			boolean wantsMinimalOutput = ans.getStatus() == ITestResult.SUCCESS;
			if (hasReporterOutput) {
				m_out.println("<h3>" + (wantsMinimalOutput ? "Expected Exception" : "Failure") + "</h3>");
			}
			generateExceptionReport(exception, method);
		}
		if (hasParameters) {
			m_out.println("</td></tr>");
		} else {
			m_out.println("</div>");
		}
	}
	if (hasParameters) {
		m_out.println("</table>");
	}
}
 
开发者ID:quanqinle,项目名称:WebAndAppUITesting,代码行数:56,代码来源:PowerEmailableReporter.java


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