Skip to main content
summaryrefslogtreecommitdiffstats
blob: 40cf0fd119e126d08ead8cc7ed2b8e961b75b5aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*******************************************************************************
 * Copyright (c) 2009, 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.BugzillaClientTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaConfigurationTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaCustomFieldsTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaFlagsTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaRepositoryConnectorConfigurationTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaRepositoryConnectorStandaloneTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaTaskCompletionTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaVersionTest;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;

/**
 * @author Steffen Pingel
 * @author Thomas Ehrnhoefer
 */
public class AllBugzillaHeadlessStandaloneTests {

	public static Test suite() {
		String[] empty = { "" };
		return suite(false, empty);
	}

	public static Test suite(boolean defaultOnly, String[] excludeFixtureArray) {
		TestSuite suite = new TestSuite(AllBugzillaHeadlessStandaloneTests.class.getName());
		// tests that only need to run once (i.e. no network i/o so doesn't matter which repository)
		suite.addTestSuite(BugzillaConfigurationTest.class);
		suite.addTestSuite(BugzillaVersionTest.class);
		suite.addTestSuite(BugzillaTaskCompletionTest.class);
		// tests that run against all repository versions
		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);
			}
		}
		return suite;
	}

	protected static void addTests(TestSuite suite, BugzillaFixture fixture) {
		fixture.createSuite(suite);
		// XXX: re-enable when webservice is used for retrieval of history
		// fixture.add(fixtureSuite, BugzillaTaskHistoryTest.class); 
		fixture.add(BugzillaRepositoryConnectorStandaloneTest.class);
		fixture.add(BugzillaRepositoryConnectorConfigurationTest.class);

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

			// Only run these tests on > 3.2 repositories
			if (!fixture.getBugzillaVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_2)) {
				fixture.add(BugzillaCustomFieldsTest.class);
				fixture.add(BugzillaFlagsTest.class);
			}
		}
		fixture.done();
	}

}

Back to the top