All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.applitools.eyes.visualgridclient.model.TestResultSummary Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package com.applitools.eyes.visualgridclient.model;

import com.applitools.eyes.TestResults;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

public class TestResultSummary {
    private List allResults;
    private int passed = 0;
    private int unresolved = 0;
    private int failed = 0;
    private int exceptions = 0;
    private int mismatches = 0;
    private int missing = 0;
    private int matches = 0;

    public TestResultSummary(List allResults) {
        this.allResults = allResults;
        for (TestResultContainer resultContainer : allResults) {
            if (resultContainer.getException() != null){
                this.exceptions++;
            }
            TestResults result = resultContainer.getTestResults();
            if (result == null) continue;
            if (result.getStatus() != null) {
                switch (result.getStatus()) {
                    case Failed:
                        this.failed++;
                        break;
                    case Passed:
                        this.passed++;
                        break;
                    case Unresolved:
                        this.unresolved++;
                        break;
                }
            }
            matches += result.getMatches();
            missing += result.getMissing();
            mismatches += result.getMismatches();
        }
    }

    public TestResultContainer[] getAllResults() {
        return allResults.toArray(new TestResultContainer[0]);
    }

    @Override
    public String toString() {
        return "result summary {" +
                "\n\tall results=\n\t\t" + StringUtils.join(allResults,"\n\t\t") +
                "\n\tpassed=" + passed +
                "\n\tunresolved=" + unresolved +
                "\n\tfailed=" + failed +
                "\n\texceptions=" + exceptions +
                "\n\tmismatches=" + mismatches +
                "\n\tmissing=" + missing +
                "\n\tmatches=" + matches +
                "\n}";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy