Bug 91320 - running model tests before dom tests causes failures
Summary: running model tests before dom tests causes failures
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-13 13:46 EDT by Mike Kaufman CLA
Modified: 2005-05-12 10:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaufman CLA 2005-04-13 13:46:16 EDT
See Junit-test below.  When getAllTestClasses() returns the 
AllJavaModelTests.class before the dom tests, the dom tests fail.  When the 
order is switched, the dom tests & model tests pass.

If this doesn't repro, please ping me. 

package repro;

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

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

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

    public static Class[] getAllTestClasses()
    {
        Class[] classes = { 
            org.eclipse.jdt.core.tests.dom.RunAllTests.class,
            org.eclipse.jdt.core.tests.model.AllJavaModelTests.class
        };
        return classes;
    }

    public static TestSuite suite()
    {
        TestSuite ts = new TestSuite( DomModelFailure.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();
                throw new RuntimeException(e);
            }
            catch( InvocationTargetException e )
            {
                e.getTargetException().printStackTrace();
                throw new RuntimeException(e);

            }
            catch( NoSuchMethodException e )
            {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        }
        return ts;
    }

}
Comment 1 Olivier Thomann CLA 2005-04-15 14:53:21 EDT
With the latest reorganization of the tests, this doesn't seem to be an issue
anymore. I could run the test suite below having:
        Class[] classes = { 
            org.eclipse.jdt.core.tests.model.AllJavaModelTests.class
            org.eclipse.jdt.core.tests.dom.RunAllTests.class,
        };

It worked fine.
Comment 2 Olivier Thomann CLA 2005-04-15 14:57:17 EDT
The problem might come from
org.eclipse.jdt.core.tests.model.OptionTests.testBug72214b() which has been
disabled.
Comment 3 Olivier Thomann CLA 2005-04-15 14:59:47 EDT
Frederic,

I think your changes for bug 91497 also fixed this issue.
Comment 4 Frederic Fusier CLA 2005-04-15 16:44:34 EDT
Correct. As getDefaultPreferences() is not longer accessible through JavaCore,
I've removed this offending test while fixing bug 91497
Comment 5 Maxime Daniel CLA 2005-05-12 09:49:43 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.