Skip to main content
summaryrefslogblamecommitdiffstats
blob: 4501fd8a08d3d2cfdc63d05b7034c51afdd3ebd8 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                                
                                                            

                                                                        
                                                           
                                            


                                                            
                                                                                 
 
                                         



                                 
                                                                      
                                                                
                                                                         



                                                                              
                                                           
                                             
 
   
                      
   
                               

                                    


                                                                                         


                                                       



                                                                                  
 
                                                                            


                                                                                     
                                                                          
                                                                                                          

                                                                                                           


                                                                             

                                                                            
                                                                        
 

                                                                                              



                                                                             










                                                                                      
                                                         
                         
                 

         





                                                                                


                                                                   





                                                                              


                                                                                    




                               
 
/*******************************************************************************
 * Copyright (c) 2004, 2010 Tasktop Technologies and others.
 * 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:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.bugzilla.tests;

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

import org.eclipse.mylyn.bugzilla.tests.core.BugzillaXmlRpcClientTest;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaHyperlinkDetectorTest;
import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaRepositorySettingsPageTest;
import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaSearchPageTest;
import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaTaskHyperlinkDetectorTest;
import org.eclipse.mylyn.bugzilla.tests.ui.TaskEditorTest;
import org.eclipse.mylyn.commons.sdk.util.ManagedTestSuite;
import org.eclipse.mylyn.tests.util.TestUtil;

/**
 * @author Mik Kersten
 */
public class AllBugzillaTests {

	public static Test suite() {
		TestSuite suite = new ManagedTestSuite(AllBugzillaTests.class.getName());
		addTests(TestUtil.runHeartbeatTestsOnly(), suite);
		return suite;
	}

	public static Test suite(boolean defaultOnly) {
		TestSuite suite = new TestSuite(AllBugzillaTests.class.getName());
		addTests(defaultOnly, suite);
		return suite;
	}

	private static void addTests(boolean defaultOnly, TestSuite suite) {
		String excludeFixture = System.getProperty("mylyn.test.exclude", "");
		String[] excludeFixtureArray = excludeFixture.split(",");

		// Standalone tests (Don't require an instance of Eclipse)
		suite.addTest(AllBugzillaHeadlessStandaloneTests.suite(defaultOnly, excludeFixtureArray));

		// Tests that only need to run once (i.e. no network io so doesn't matter which repository)
		suite.addTestSuite(TaskEditorTest.class);
		suite.addTestSuite(BugzillaRepositorySettingsPageTest.class);
		suite.addTestSuite(BugzillaSearchPageTest.class);
		suite.addTestSuite(BugzillaDateTimeTests.class);
		suite.addTestSuite(BugzillaTaskHyperlinkDetectorTest.class);
		suite.addTestSuite(BugzillaHyperlinkDetectorTest.class);

		// Each of these tests gets executed against every repo in BugzillaFixture.ALL
		// unless otherwise excluded
		if (defaultOnly) {
			addTests(suite, BugzillaFixture.DEFAULT);
		} else {
			for (BugzillaFixture fixture : BugzillaFixture.ALL) {
				String fixtureURL = fixture.getRepositoryUrl();
				boolean excludeFound = false;
				for (String excludeFixtureURL : excludeFixtureArray) {
					if (excludeFixtureURL.equals(fixtureURL)) {
						excludeFound = true;
						break;
					}
				}
				if (excludeFound) {
					continue;
				}
				addTests(suite, fixture);
			}
		}
	}

	private static void addTests(TestSuite suite, BugzillaFixture fixture) {
		fixture.createSuite(suite);
		fixture.add(RepositoryReportFactoryTest.class);
		fixture.add(BugzillaTaskDataHandlerTest.class);
		fixture.add(BugzillaSearchTest.class);
		fixture.add(EncodingTest.class);
		fixture.add(BugzillaXmlRpcClientTest.class);
		fixture.add(BugzillaRepositoryConnectorTest.class);
		fixture.add(BugzillaAttachmentHandlerTest.class);

		// Move any tests here that are resulting in spurious failures
		// due to recent changes in Bugzilla Server head.
		if (fixture != BugzillaFixture.BUGS_HEAD) {
		}

		// Only run this if we have custom status and Workflow
		if (fixture.equals(BugzillaFixture.BUGS_3_6_CUSTOM_WF_AND_STATUS)) {
			fixture.add(BugzillaCustomRepositoryTest.class);
		}

		fixture.done();
	}

}

Back to the top