You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2013/07/03 14:58:46 UTC
svn commit: r1499378 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/core/ lucene/core/src/test/org/apache/lucene/util/junitcompat/
lucene/test-framework/ lucene/test-framework/src/java/org/apache/lucene/util/
Author: dweiss
Date: Wed Jul 3 12:58:46 2013
New Revision: 1499378
URL: http://svn.apache.org/r1499378
Log:
LUCENE-5059: Report -Dtests.method properly when Repeat annotation is used(strip augmentations).
Added:
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessageWithRepeated.java
- copied unchanged from r1499376, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessageWithRepeated.java
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java?rev=1499378&r1=1499377&r2=1499378&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RunListenerPrintReproduceInfo.java Wed Jul 3 12:58:46 2013
@@ -88,12 +88,27 @@ public final class RunListenerPrintRepro
@Override
public void testFinished(Description description) throws Exception {
if (testFailed) {
- reportAdditionalFailureInfo(description.getMethodName());
+ reportAdditionalFailureInfo(
+ stripTestNameAugmentations(
+ description.getMethodName()));
}
scope = LifecycleScope.SUITE;
testFailed = false;
}
+ /**
+ * The {@link Description} object in JUnit does not expose the actual test method,
+ * instead it has the concept of a unique "name" of a test. To run the same method (tests)
+ * repeatedly, randomizedtesting must make those "names" unique: it appends the current iteration
+ * and seeds to the test method's name. We strip this information here.
+ */
+ private String stripTestNameAugmentations(String methodName) {
+ if (methodName != null) {
+ methodName = methodName.replaceAll("\\s*\\{.+?\\}", "");
+ }
+ return methodName;
+ }
+
@Override
public void testRunFinished(Result result) throws Exception {
if (printDiagnosticsAfterClass || LuceneTestCase.VERBOSE) {