view src/org/thermostat/qa2/reporter/result/TestClassResult.java @ 181:e37e710e45df

added support for compatibility tests and some other improvements (generating thermostat config files from templates, posiblity to show @Before methods logs in report, ...) Changes: Makefile: - added targets new for compatibility testing (and report generation) src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java: - all thermostat and storage configuration code moved from TestRunner to ThermostatUtilities class - webapp deployment (tomcat) is moved from makefile to testsuite (ThermostatUtilities class) - storage configuration files are now generated from templates, which are placed in templates directory - added helper methods, which make using thermostat shell simpler src/org/thermostat/qa2/framework/utils/ThermostatUtilities.java: - code needed for replacing patterns moved from reporters Generator class to CommonUtilities class (because it is now also used to generate config files from templates) src/org/thermostat/qa2/reporter/Generator.java: src/org/thermostat/qa2/reporter/LogParser.java: src/org/thermostat/qa2/reporter/result/TestClassResult.java: src/org/thermostat/qa2/framework/TestRunner.java - added possibility to show logs of methods annotaded with @Before annotation, when some of tests in that their test class failes src/org/thermostat/qa2/tests/DBCommandsHeapDumpTest.java: - code updated to use new methods from ThermostatUtilities class src/org/thermostat/qa2/framework/annotations/SetupStorage.java - it is now possible set SAVE_ON_EXIT property in agent.properties using this annotation src/org/thermostat/qa2/framework/services/ThermostatStorage.java - framework is now not waiting for timeout, when message about thermostat setup is displayed src/org/thermostat/qa2/framework/ThermostatQAConfig.java - added/updated to contain framework new configuration data, removed code not needed anymore templates/storage-config/* - added thermostat config files templates
author Zdenek Zambersky <zzambers@redhat.com>
date Fri, 15 May 2015 18:51:56 +0200
parents 6b6ac47a811f
children
line wrap: on
line source

/*
 ThermostatQA - test framework for Thermostat Monitoring Tool

 Copyright 2015 Red Hat, Inc.

 This file is part of ThermostatQA

 ThermostatQA is distributed under the GNU General Public License,
 version 2 or any later version (with a special exception described
 below, commonly known as the "Classpath Exception").

 A copy of GNU General Public License (GPL) is included in this
 distribution, in the file COPYING.

 Linking ThermostatQA code with other modules is making a combined work
 based on ThermostatQA.  Thus, the terms and conditions of the GPL
 cover the whole combination.

 As a special exception, the copyright holders of ThermostatQA give you
 permission to link this code with independent modules to produce an
 executable, regardless of the license terms of these independent
 modules, and to copy and distribute the resulting executable under
 terms of your choice, provided that you also meet, for each linked
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on ThermostatQA code.  If you modify ThermostatQA, you may
 extend this exception to your version of the software, but you are
 not obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.
 */
package org.thermostat.qa2.reporter.result;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.thermostat.qa2.framework.TestResult;
import static org.thermostat.qa2.framework.TestResult.*;

/**
 *
 * @author Zdeněk Žamberský
 */
public class TestClassResult {

    public String name;
    public List<TestMethodResult> methods;
    public List<TestMethodResult> beforeMethods;
    public Map<String, TestMethodResult> methodsMap = new HashMap();

    public int methodCount;
    public int passedCount;
    public int failedCount;
    public int errorCount;
    public int ignoredCount;

    public long duration;

    public TestClassResult(String name, List<TestMethodResult> methods, List<TestMethodResult> beforeMethods, long duration) {
        this.name = name;
        this.methods = methods;
        this.beforeMethods = beforeMethods;
        this.duration = duration;
        for (TestMethodResult method : methods) {
            methodsMap.put(method.name, method);
            TestResult result = method.getResult();
            switch (result) {
                case PASSED:
                    ++passedCount;
                    break;
                case FAILED:
                    ++failedCount;
                    break;
                case ERROR:
                    ++errorCount;
                    break;
                case IGNORED:
                    ++ignoredCount;
                    break;
            }
            ++methodCount;
        }
    }

    public TestMethodResult getMethod(String name) {
        return methodsMap.get(name);
    }
}