Bug 91438

Summary: Need definitive set of jdt-core tests checked into cvs
Product: [Eclipse Project] JDT Reporter: Mike Kaufman <mkaufman>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mkaufman
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Mike Kaufman CLA 2005-04-14 14:35:56 EDT
Right now, the set of JDT core tests to run is not checked into cvs.  jdt-core 
team has an internal class to run all the tests, but these contain some 
proprietary stuff that can't be in cvs.  

We need to get something into CVS that defines the set of all public jdt-core 
tests. 

Here's a starting point:




/******************************************************************************
*
 * Copyright (c) 2005 BEA Systems, Inc. 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    mkaufman@bea.com - initial API and implementation
 *    
 
*******************************************************************************
/

package org.eclipse.jdt.apt.tests.jdtcoretests;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class AllJdtCoreTests extends TestCase {
	
    public AllJdtCoreTests(String testName) 
    {
        super(testName);
    }
	

    public static Class[] getAllTestClasses()
    {
        //
        // please be careful of the ordering of the test classes below. 
        // the tests passing successfully seems to be dependent on the order
        // the test classes are specified.
        //
        Class[] classes = { 
            org.eclipse.jdt.core.tests.builder.Tests.class,
            
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests.class,
            org.eclipse.jdt.core.tests.dom.RunAllTests.class,
            org.eclipse.jdt.core.tests.model.AllJavaModelTests.class,	
		 
            org.eclipse.jdt.core.tests.compiler.parser.TestAll.class,
            org.eclipse.jdt.core.tests.eval.TestAll.class,
            org.eclipse.jdt.core.tests.compiler.regression.TestAll.class
        };
		
        return classes;
    }

    public static TestSuite suite()
    {
        TestSuite ts = new TestSuite( AllJdtCoreTests.class.getName() );

        Class[] testClasses = getAllTestClasses();
        for( int i = 0; i < testClasses.length; i++ )
        {
            Class testClass = testClasses[i];

            // call the suite() method and add the resulting suite
            // to the suite
            try
            {
                Method suiteMethod = testClass.getDeclaredMethod(
                    "suite", new Class[0] ); //$NON-NLS-1$
                Test suite = ( Test ) suiteMethod.invoke( null, new Object
[0] );
                ts.addTest( suite );
            }
            catch( IllegalAccessException e )
            {
                e.printStackTrace();
            }
            catch( InvocationTargetException e )
            {
                e.getTargetException().printStackTrace();
            }
            catch( NoSuchMethodException e )
            {

            }
        }
        return ts;
    }

}
Comment 1 Jerome Lanneluc CLA 2005-04-15 07:35:08 EDT
Added the following helper test runners in org.eclipse.jdt.core.tests.model:
- RunBuilderTests
- RunCompilerTests
- RunDOMTests
- RunFormatterTests
- RunModelTests
- RunJDTCoreTests

So to run all public JDT Core tests, run
org.eclipse.jdt.core.tests.model/org.eclipse.jdt.core.tests.RunJDTCoreTests
Comment 2 Frederic Fusier CLA 2005-05-11 10:34:42 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.