Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #640 from zanata/improve-test-isolation
Browse files Browse the repository at this point in the history
Use SampleProjectRule as @rule, not @ClassRule
  • Loading branch information
seanf committed Nov 27, 2014
2 parents 3975476 + 6a8340d commit aec1b31
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
Expand Up @@ -21,7 +21,6 @@
package org.zanata.feature.document;

import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -48,8 +47,8 @@
@Category(DetailedTest.class)
public class SubtitleDocumentTypeTest extends ZanataTestCase {

@ClassRule
public static SampleProjectRule sampleProjectRule = new SampleProjectRule();
@Rule
public SampleProjectRule sampleProjectRule = new SampleProjectRule();

@Rule
public CleanDocumentStorageRule documentStorageRule =
Expand Down
Expand Up @@ -20,7 +20,7 @@
*/
package org.zanata.feature.language;

import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.Feature;
Expand All @@ -39,8 +39,8 @@
@Category(DetailedTest.class)
public class JoinLanguageTeamTest extends ZanataTestCase {

@ClassRule
public static SampleProjectRule sampleProjectRule = new SampleProjectRule();
@Rule
public SampleProjectRule sampleProjectRule = new SampleProjectRule();

@Feature(summary = "The administrator can add a member to a language team",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 181703)
Expand Down
Expand Up @@ -21,7 +21,7 @@

package org.zanata.feature.projectversion;

import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.Feature;
Expand All @@ -44,8 +44,8 @@
@Category(DetailedTest.class)
public class CreateProjectVersionTest extends ZanataTestCase {

@ClassRule
public static SampleProjectRule sampleProjectRule = new SampleProjectRule();
@Rule
public SampleProjectRule sampleProjectRule = new SampleProjectRule();

@Feature(summary = "The administrator can create a project version",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 136517)
Expand Down Expand Up @@ -130,7 +130,9 @@ public void idStartsAndEndsWithAlphanumeric() throws Exception {
@Feature(summary = "The system updates the project version counter " +
"when a project version is created",
tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0)
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
@Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION,
// remove when rhbz1168447 is fixed:
expected = org.openqa.selenium.TimeoutException.class)
public void versionCounterIsUpdated() throws Exception {
String projectName = "version nums";

Expand Down
Expand Up @@ -21,7 +21,7 @@

package org.zanata.feature.projectversion;

import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.zanata.feature.Feature;
Expand All @@ -44,8 +44,8 @@
@Category(DetailedTest.class)
public class VersionFilteringTest extends ZanataTestCase {

@ClassRule
public static SampleProjectRule sampleProjectRule = new SampleProjectRule();
@Rule
public SampleProjectRule sampleProjectRule = new SampleProjectRule();

private ZanataRestCaller zanataRestCaller;

Expand Down
Expand Up @@ -27,6 +27,8 @@
import static org.zanata.util.SampleDataResourceClient.*;

/**
* To ensure test isolation, this rule should be used as
* @org.junit.Rule, never as @org.junit.ClassRule.
* @author Patrick Huang <a
* href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
Expand Down

0 comments on commit aec1b31

Please sign in to comment.