Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-10-19 23:53:56 +0000
committerMatthias Sohn2013-10-22 13:38:17 +0000
commitfed21849f6a0fc2003a30bc036cefbbdf428a8cb (patch)
tree7adbfbfb4309e6b5664dd40b6b36d54e845becb9 /org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history
parent448b9ac17151d750e0389b41c20f6800fc568406 (diff)
downloadegit-fed21849f6a0fc2003a30bc036cefbbdf428a8cb.tar.gz
egit-fed21849f6a0fc2003a30bc036cefbbdf428a8cb.tar.xz
egit-fed21849f6a0fc2003a30bc036cefbbdf428a8cb.zip
Fix UI tests interfering with each other because of shared test setup
The most common cause of unstable UI tests was that the test data (repositories and projects) was set up once per class, and then each test method used the same data. When one test method only reads the data but another modifies it, the test may fail depending on the order of execution. This is an attempt to fix this by changing the test setup so that it's done once per test method (@Before instead of @BeforeClass). To make it easier (and possibly faster) to clean up and reduce the possibility of accidentally sharing the data, the data for each test method is created in a separate directory. Change-Id: I2d7ae4e86c08483a1e8a2824a31648f9d6827bf8 Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
index 3d0c046a4..bb91cda3b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
@@ -45,7 +45,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,13 +58,12 @@ public class HistoryViewTest extends LocalRepositoryTestCase {
private static final String ADDEDMESSAGE = "A new file in a new folder";
- private static int commitCount;
+ private int commitCount;
- private static File repoFile;
+ private File repoFile;
- @BeforeClass
- public static void setup() throws Exception {
- // File repoFile =
+ @Before
+ public void setup() throws Exception {
repoFile = createProjectAndCommitToRepository();
IProject prj = ResourcesPlugin.getWorkspace().getRoot()
.getProject(PROJ1);

Back to the top