LUCENE-3993: Polishing annoyances from JUnit4

- print @Ignore/@Assumption cause.
- perturb randomness in static contexts (LUCENE-3995).
- intellij idea (in)compatibilities.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1327554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2012-04-18 15:58:25 +00:00
parent 24b2c545d8
commit 13653afe5c
10 changed files with 12 additions and 11 deletions

View File

@ -170,6 +170,6 @@
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-beanutils-1.7.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lucene/test-framework/lib/randomizedtesting-runner-1.2.0.jar"/>
<classpathentry kind="lib" path="lucene/test-framework/lib/randomizedtesting-runner-1.3.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -2,7 +2,7 @@
<library name="JUnit">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/junit-4.10.jar!/" />
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-1.2.0.jar!/" />
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-1.3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -193,8 +193,6 @@ public class TestReproduceMessage extends WithNestedTests {
final String syserr = runAndReturnSyserr();
super.prevSysOut.println(getSysErr() + "\n" + getSysOut());
Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));

View File

@ -23,8 +23,8 @@
<dependency org="org.apache.ant" name="ant-junit" rev="1.7.1" transitive="false"/>
<dependency org="junit" name="junit" rev="4.10" transitive="false"/>
<dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="1.2.0" transitive="false" />
<dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="1.2.0" transitive="false"/>
<dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="1.3.0" transitive="false" />
<dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="1.3.0" transitive="false"/>
<exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/>
</dependencies>

View File

@ -1 +0,0 @@
68caf5916290e52964f1a437a398c09e8c950d71

View File

@ -0,0 +1 @@
a367f0573ef833d8ac0b73654b8e0b82ad73b773

View File

@ -1 +0,0 @@
a804c83963e6fed618cfeed7cd2fda127d69f8d3

View File

@ -0,0 +1 @@
ca4ac3a5419a9d0176fa24acd1be84f431bfe8d1

View File

@ -110,6 +110,7 @@ import org.junit.runners.model.MultipleFailureException;
import org.junit.runners.model.Statement;
import com.carrotsearch.randomizedtesting.JUnit4MethodProvider;
import com.carrotsearch.randomizedtesting.MixWithSuiteName;
import com.carrotsearch.randomizedtesting.RandomizedContext;
import com.carrotsearch.randomizedtesting.RandomizedRunner;
import com.carrotsearch.randomizedtesting.annotations.*;
@ -140,6 +141,7 @@ import com.carrotsearch.randomizedtesting.annotations.*;
* if you annotate your derived class correctly with the annotations above
* @see #assertSaneFieldCaches(String)
*/
@RunWith(RandomizedRunner.class)
@TestMethodProviders({
LuceneJUnit3MethodProvider.class,
JUnit4MethodProvider.class
@ -148,11 +150,11 @@ import com.carrotsearch.randomizedtesting.annotations.*;
RequireAssertions.class,
NoStaticHooksShadowing.class
})
@RunWith(RandomizedRunner.class)
@SeedDecorators({MixWithSuiteName.class}) // See LUCENE-3995 for rationale.
@ThreadLeaks(failTestIfLeaking = false)
public abstract class LuceneTestCase extends Assert {
/**
* true iff tests are run in verbose mode. Note: if it is false, tests are not
* true if and only if tests are run in verbose mode. Note: if it is false, tests are not
* expected to print any messages.
*/
public static final boolean VERBOSE = Boolean.getBoolean("tests.verbose");
@ -406,6 +408,7 @@ public abstract class LuceneTestCase extends Assert {
savedCodec = Codec.getDefault();
final Codec codec;
int randomVal = random().nextInt(10);
System.out.println("randomVal: " + randomVal);
if ("Lucene3x".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal < 2)) { // preflex-only setup
codec = Codec.forName("Lucene3x");

View File

@ -1 +1 @@
7999a63bfccbc7c247a9aea10d83d4272bd492c6
7999a63bfccbc7c247a9aea10d83d4272bd492c6