本文整理汇总了Java中org.testng.ISuiteResult类的典型用法代码示例。如果您正苦于以下问题:Java ISuiteResult类的具体用法?Java ISuiteResult怎么用?Java ISuiteResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISuiteResult类属于org.testng包,在下文中一共展示了ISuiteResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculate
import org.testng.ISuiteResult; //导入依赖的package包/类
private void calculate() {
if (!this.counts.isEmpty()) return;
int passed = 0;
int failed = 0;
int skipped = 0;
for (ISuite suite : this.reports) {
for (ISuiteResult result : suite.getResults().values()) {
final ITestContext testContext = result.getTestContext();
passed += testContext.getPassedTests().size();
failed += testContext.getFailedTests().size();
skipped += testContext.getSkippedTests().size();
}
}
this.counts.add(0, passed + failed + skipped);
this.counts.add(1, failed);
this.counts.add(2, skipped);
}
示例2: generateMethodDetailReport
import org.testng.ISuiteResult; //导入依赖的package包/类
/**
* Creates a section showing known results for each method
*/
protected void generateMethodDetailReport(List<ISuite> suites)
{
m_methodIndex = 0;
for (ISuite suite : suites)
{
Map<String, ISuiteResult> r = suite.getResults();
for (ISuiteResult r2 : r.values())
{
ITestContext testContext = r2.getTestContext();
if (r.values().size() > 0)
{
m_out.println("<h1>" + testContext.getName() + "</h1>");
}
resultDetail(testContext.getFailedConfigurations(), "failed");
resultDetail(testContext.getFailedTests(), "failed");
resultDetail(testContext.getSkippedConfigurations(), "skipped");
resultDetail(testContext.getSkippedTests(), "skipped");
resultDetail(testContext.getPassedTests(), "passed");
}
}
}
示例3: getTotalSkippedMethodsForTest
import org.testng.ISuiteResult; //导入依赖的package包/类
public int getTotalSkippedMethodsForTest(final String testName)
{
int totalNumberOfSkippedMethodsForTest = 0;
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 (testName.equalsIgnoreCase(overview.getName()))
{
totalNumberOfSkippedMethodsForTest = overview.getSkippedTests().getAllMethods().size();
break;
}
}
}
return totalNumberOfSkippedMethodsForTest;
}
示例4: getAllParametersForTest
import org.testng.ISuiteResult; //导入依赖的package包/类
public Map<String, String> getAllParametersForTest(String testName)
{
ITestContext overview = null;
for (ISuite suite : suites)
{
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (testName.equalsIgnoreCase(overview.getName()))
{
return overview.getCurrentXmlTest().getAllParameters();
}
}
}
return null;
}
示例5: getParameterValueForTest
import org.testng.ISuiteResult; //导入依赖的package包/类
public String getParameterValueForTest(String testName, String parameter)
{
ITestContext overview = null;
for (ISuite suite : suites)
{
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (testName.equalsIgnoreCase(overview.getName()))
{
return overview.getCurrentXmlTest().getParameter(parameter);
}
}
}
return null;
}
示例6: getAllMethodsForTest
import org.testng.ISuiteResult; //导入依赖的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;
}
示例7: generateMethodSummaryReport
import org.testng.ISuiteResult; //导入依赖的package包/类
/**
* Creates a table showing the highlights of each test method with links to the method details
*/
protected void generateMethodSummaryReport(List<ISuite> suites)
{
m_methodIndex = 0;
m_out.println("<a id=\"summary\"></a>");
startResultSummaryTable("passed");
for (ISuite suite : suites)
{
if (suites.size() > 1)
{
titleRow(suite.getName(), 4);
}
Map<String, ISuiteResult> r = suite.getResults();
for (ISuiteResult r2 : r.values())
{
ITestContext testContext = r2.getTestContext();
String testName = testContext.getName();
resultSummary(testContext.getFailedConfigurations(), testName, "failed", " (configuration methods)");
resultSummary(testContext.getFailedTests(), testName, "failed", "");
resultSummary(testContext.getSkippedConfigurations(), testName, "skipped", " (configuration methods)");
resultSummary(testContext.getSkippedTests(), testName, "skipped", "");
resultSummary(testContext.getPassedTests(), testName, "passed", "");
}
}
m_out.println("</table>");
}
示例8: generateReport
import org.testng.ISuiteResult; //导入依赖的package包/类
@Override
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
StringBuilder sb = new StringBuilder();
for (ISuite suite : suites) {
Map<String, ISuiteResult> results = suite.getResults();
for (Map.Entry<String, ISuiteResult> result : results.entrySet()) {
String report = buildReport(result.getValue().getTestContext());
sb.append(report);
}
}
try {
FileUtils.writeToFile(new File(FAILED_REPORT_FILE), sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
示例9: generateReport
import org.testng.ISuiteResult; //导入依赖的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");
}
示例10: generateMethodSummaryReport
import org.testng.ISuiteResult; //导入依赖的package包/类
/**
* Creates a table showing the highlights of each test method with links to
* the method details
*/
protected void generateMethodSummaryReport(List<ISuite> suites) {
startResultSummaryTable("methodOverview");
int testIndex = 1;
for (ISuite suite : suites) {
if (suites.size() > 1) {
titleRow(suite.getName(), 5);
}
Map<String, ISuiteResult> r = suite.getResults();
for (ISuiteResult r2 : r.values()) {
ITestContext testContext = r2.getTestContext();
String testName = testContext.getName();
m_testIndex = testIndex;
resultSummary(suite, testContext.getSkippedConfigurations(), testName, "skipped", " (configuration methods)");
resultSummary(suite, testContext.getSkippedTests(), testName, "skipped", "");
resultSummary(suite, testContext.getFailedConfigurations(), testName, "failed", " (configuration methods)");
resultSummary(suite, testContext.getFailedTests(), testName, "failed", "");
resultSummary(suite, testContext.getPassedTests(), testName, "passed", "");
testIndex++;
}
}
m_out.println("</table>");
}
示例11: generateMethodDetailReport
import org.testng.ISuiteResult; //导入依赖的package包/类
/** Creates a section showing known results for each method */
protected void generateMethodDetailReport(List<ISuite> suites) {
for (ISuite suite : suites) {
Map<String, ISuiteResult> r = suite.getResults();
for (ISuiteResult r2 : r.values()) {
ITestContext testContext = r2.getTestContext();
if (r.values().size() > 0) {
m_out.println("<h1>" + testContext.getName() + "</h1>");
}
resultDetail(testContext.getFailedConfigurations());
resultDetail(testContext.getFailedTests());
resultDetail(testContext.getSkippedConfigurations());
resultDetail(testContext.getSkippedTests());
resultDetail(testContext.getPassedTests());
}
}
}
示例12: getSummaryDetails
import org.testng.ISuiteResult; //导入依赖的package包/类
private JSONObject getSummaryDetails(Map<String, ISuiteResult> results) {
Object firstSuite = results.keySet().toArray()[0];
ISuiteResult result = results.get(firstSuite);
ITestContext testContext = result.getTestContext();
int passedTests = testContext.getPassedTests().getAllResults().size();
int failedTests = testContext.getFailedTests().getAllResults().size();
int skippedTests = testContext.getSkippedTests().getAllResults().size();
String suiteName = testContext.getName();
//String includedGroups = testContext.getIncludedGroups().toString();
JSONObject jsonSummary = new JSONObject();
jsonSummary.put("suite_name", suiteName);
//jsonSummary.put("Included Groups", includedGroups);
jsonSummary.put("passed", passedTests);
jsonSummary.put("failed", failedTests);
jsonSummary.put("skipped", skippedTests);
jsonSummary.put("duration", Duration.of(testContext.getEndDate().getTime()
- testContext.getStartDate().getTime(), ChronoUnit.SECONDS));
return jsonSummary;
}
示例13: logAllValidFailuresToPipline
import org.testng.ISuiteResult; //导入依赖的package包/类
private void logAllValidFailuresToPipline(java.util.List<ISuite> suites) {
//Reporter.startRun(runId);
for (ISuite suite : suites) {
for (ISuiteResult result : suite.getResults().values()) {
for (ITestResult failedResult : result.getTestContext().getFailedTests().getAllResults()){
if (failedResult.getAttribute("RETRY") != null) {
continue;
}
String browser = getBrowserName(failedResult);
String site = getSiteName(failedResult);
LOG(Level.SEVERE, String.format("[STACK TARCE] for [%s] [%s]%s \n %s",
browser,
site,
getTestMethodNameinPackageStyle(failedResult),
getDetailedStackTrace(failedResult)));
logResultsToPipeline(failedResult);
}
}
}
}
示例14: generateConsolidatedReportByOwner
import org.testng.ISuiteResult; //导入依赖的package包/类
public void generateConsolidatedReportByOwner(java.util.List<XmlSuite> xmlSuites,
java.util.List<ISuite> suites, java.lang.String outputDirectory) {
Map<String, List<ITestResult>> ownersOfFailedTests = new HashMap<String, List<ITestResult>>();
Map<String, List<ITestResult>> ownersOfPassedTests = new HashMap<String, List<ITestResult>>();
for (ISuite suite : suites) {
for (ISuiteResult result : suite.getResults().values()) {
ownersOfPassedTests = getTestByOwnerSiteBrowser(result.getTestContext().getPassedTests().getAllResults());
ownersOfFailedTests = getTestByOwnerSiteBrowser(result.getTestContext().getFailedTests().getAllResults());
}
}
// Send consolidated failures to the Team group email id.
TestNGEmailSender.sendConsolidatedFailureEmail(ownersOfPassedTests, ownersOfFailedTests);
}
示例15: flattenResults
import org.testng.ISuiteResult; //导入依赖的package包/类
/**
* Flatten a list of test suite results into a collection of results grouped by test class.
* This method basically strips away the TestNG way of organising tests and arranges
* the results by test class.
*/
private Collection<TestClassResults> flattenResults(List<ISuite> suites) {
Map<IClass, TestClassResults> flattenedResults = new HashMap<>();
for (ISuite suite : suites) {
for (ISuiteResult suiteResult : suite.getResults().values()) {
// Failed and skipped configuration methods are treated as test failures.
organiseByClass(suiteResult.getTestContext().getFailedConfigurations().getAllResults(), flattenedResults);
organiseByClass(suiteResult.getTestContext().getSkippedConfigurations().getAllResults(), flattenedResults);
// Successful configuration methods are not included.
organiseByClass(suiteResult.getTestContext().getFailedTests().getAllResults(), flattenedResults);
organiseByClass(suiteResult.getTestContext().getSkippedTests().getAllResults(), flattenedResults);
organiseByClass(suiteResult.getTestContext().getPassedTests().getAllResults(), flattenedResults);
}
}
return flattenedResults.values();
}