/*
 * Copyright (C) 1999-2007 <a href="mailto:paschke@in.tum.de">Adrian Paschke</a>
 * 
 * The Regression Test framework is part of the Rule Based Service Level Agreement (RBSLA)
 * project, available at 
 * <a href=" http://ibis.in.tum.de/staff/paschke/rbsla/index.htm">RBSLA</a>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package rbsla.regressiontest;

import junit.framework.TestSuite;
import rbsla.wrapper.ProvaWrapper;

import java.util.List;



/**
 * Test suite for a automatic regression tests of the RBSLA/ConractLog framework.
 * The system is able to automaticly execute the tests and create a test report using JUnit.
 * 
 * @author <A HREF="mailto:paschke@in.tum.de">Adrian Paschke</A>
 * @version 0.1 <1 Sept 2005>
 * @since 0.1
 */
public class RegressionTestSuite extends TestSuite
{
	
	
    /**
     * Get a test suite. This suite is the result of merging
     * all test cases defined in the ./rules/test/tests.prova script.
     * @return a test suite
     */
    public static TestSuite suite() {
        TestSuite suite      = new TestSuite ("All RBSLA test cases");
        ProvaWrapper wrapper = new ProvaWrapper("./examples/test_cases/tests.prova");
		List testCases = wrapper.solveVar("test(TestCase)","TestCase");		
        for(int i = 0; i < testCases.size(); i++) {
            try {
               String testCase = testCases.get(i).toString();			   
			   RegressionTest test = new RegressionTest(testCase);				   
               suite.addTest (test);
            } catch(Exception x) {
                System.err.println ("Cannot create merged test suite!");
                x.printStackTrace (System.err);
            }
        }		
        return suite;
    }

}