[ 
https://issues.apache.org/jira/browse/GEODE-4073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286559#comment-16286559
 ] 

ASF GitHub Bot commented on GEODE-4073:
---------------------------------------

jdeppe-pivotal closed pull request #1150: GEODE-4073: Add ability for 
SuiteRunner to interleave a candidate tes…
URL: https://github.com/apache/geode/pull/1150
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteBlockRunner.java
 
b/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteBlockRunner.java
index ef62077ac5..e4663fae54 100644
--- 
a/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteBlockRunner.java
+++ 
b/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteBlockRunner.java
@@ -39,6 +39,7 @@ public SuiteBlockRunner(final Class parentClass, final 
Class<?> testClass)
 
   @Override
   protected String testName(FrameworkMethod method) {
-    return method.getName() + "@" + suiteClass.getName();
+    // Some tests use the test name as the region name, so make sure we have 
valid chars
+    return method.getName() + "-" + suiteClass.getName().replace(".", "-");
   }
 }
diff --git 
a/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteRunner.java
 
b/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteRunner.java
index dfa7b950b6..19bb530e72 100644
--- 
a/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteRunner.java
+++ 
b/geode-junit/src/main/java/org/apache/geode/test/junit/runners/SuiteRunner.java
@@ -14,6 +14,11 @@
  */
 package org.apache.geode.test.junit.runners;
 
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -33,6 +38,16 @@
  */
 public class SuiteRunner extends Suite {
 
+  @Retention(RetentionPolicy.RUNTIME)
+  @Target(ElementType.TYPE)
+  @Inherited
+  public @interface Candidate {
+    /**
+     * @return the classes to be run
+     */
+    public Class<?> value();
+  }
+
   public SuiteRunner(final Class<?> testClass, final RunnerBuilder builder)
       throws InitializationError {
     super(testClass, getRunners(testClass));
@@ -44,10 +59,21 @@ public SuiteRunner(final Class<?> testClass, final 
RunnerBuilder builder)
       throw new InitializationError(
           String.format("class '%s' must have a SuiteClasses annotation", 
testClass.getName()));
     }
+
+    SuiteRunner.Candidate candidate = testClass.getAnnotation(Candidate.class);
+    Class<?> candidateClass = null;
+    if (candidate != null) {
+      candidateClass = candidate.value();
+    }
+
     Class<?>[] childClasses = annotation.value();
     List<Runner> runners = new ArrayList<>();
     for (Class childClass : childClasses) {
       runners.add(new SuiteBlockRunner(testClass, childClass));
+
+      if (candidateClass != null) {
+        runners.add(new SuiteBlockRunner(testClass, candidateClass));
+      }
     }
     return runners;
   }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Allow SuiteRunner to run all suite tests each followed by a candidate test
> --------------------------------------------------------------------------
>
>                 Key: GEODE-4073
>                 URL: https://issues.apache.org/jira/browse/GEODE-4073
>             Project: Geode
>          Issue Type: Test
>          Components: tests
>            Reporter: Jens Deppe
>
> Sometimes I'm trying to track down which test has dirtied the environment for 
> a specific test. I want to specify a set of tests and have each test be run, 
> followed by my candidate (failing) test.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to