[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-12 Thread mpkorstanje
Github user mpkorstanje commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r138477890
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/MatchMethodDescriptions.java
 ---
@@ -0,0 +1,74 @@
+package org.apache.maven.surefire.common.junit48;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Only run test methods in the given failure set
+ *
+ * @author mpkorstanje
+ */
+final class MatchMethodDescriptions
+extends Filter
+{
+
+private final List filters = new ArrayList();
+
+MatchMethodDescriptions( Iterable descriptions )
+{
+for ( Description description : descriptions )
+{
+filters.add( matchMethodDescription ( description ) );
+}
+}
+
+@Override
+public boolean shouldRun( Description description )
+{
+for ( Filter filter : filters )
+{
+if ( filter.shouldRun( description ) )
+{
+return true;
+}
+}
+return false;
+}
+
+@Override
+public String describe()
+{
+StringBuilder description = new StringBuilder( "Matching 
description " );
+for ( int i = 0; i < filters.size(); i++ )
+{
+description.append( filters.get( i ).describe() );
+if ( i != filters.size() - 1 )
+{
+description.append( " OR " );
+}
+}
+return description.toString();
+}
+}
--- End diff --

Done.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-12 Thread mpkorstanje
Github user mpkorstanje commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r138472979
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FailingMethodFilter.java
 ---
@@ -1,85 +0,0 @@
-package org.apache.maven.surefire.common.junit48;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.shared.utils.io.SelectorUtils;
-import org.junit.runner.Description;
-import org.junit.runner.manipulation.Filter;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Only run test methods in the given input map, indexed by test class
- */
-final class FailingMethodFilter
--- End diff --

This is not really possible as as the way we're dealing selecting the tests 
to rerun has changed fundamentally. I have however added 
`JUnit4ProviderUtilTest#testGenerateFailingTestDescriptions` to show 
equivalence to `JUnit4ProviderUtilTest#testGenerateFailingTests`

This shows that the set of failed tests is the same as before - though 
described in a different format.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-11 Thread mpkorstanje
Github user mpkorstanje commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r138170535
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/MatchMethodDescriptions.java
 ---
@@ -0,0 +1,74 @@
+package org.apache.maven.surefire.common.junit48;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Only run test methods in the given failure set
+ *
+ * @author mpkorstanje
+ */
+final class MatchMethodDescriptions
+extends Filter
+{
+
+private final List filters = new ArrayList();
+
+MatchMethodDescriptions( Iterable descriptions )
+{
+for ( Description description : descriptions )
+{
+filters.add( matchMethodDescription ( description ) );
+}
+}
+
+@Override
+public boolean shouldRun( Description description )
+{
+for ( Filter filter : filters )
--- End diff --

`MatchMethodDescriptions` is created with a list of failed test 
descriptions. FailingMethodFilter was created with a list of failed 
class-method tuples.

When `shouldRun` is called the `FailingMethodFilter` would recurse down the 
description tree to find a leave (a test case).  For each leave it uses the 
class of the description to find the set of failed methods for that class. Then 
it tests if the set of failed methods contain the method of the description. If 
so it returns true and the test should be rerun.

When `shouldRun` is called the `MatchMethodDescriptions` will check for 
each failed-test-description if it can be found in the the tree of 
descriptions. This is done by delegating the recursive descent search to 
`Filter#matchMethodDescription`. `matchMethodDescription` recurses until it 
finds a leave, when found it compares descriptions.

This should explain where the recursion has been removed.




---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136932755
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FailingMethodFilter.java
 ---
@@ -1,85 +0,0 @@
-package org.apache.maven.surefire.common.junit48;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.shared.utils.io.SelectorUtils;
-import org.junit.runner.Description;
-import org.junit.runner.manipulation.Filter;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Only run test methods in the given input map, indexed by test class
- */
-final class FailingMethodFilter
--- End diff --

Before deleting a class, tests with high coverage should be added and new 
implementation should pass on them.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136932487
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/MatchMethodDescriptions.java
 ---
@@ -0,0 +1,74 @@
+package org.apache.maven.surefire.common.junit48;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Only run test methods in the given failure set
+ *
+ * @author mpkorstanje
+ */
+final class MatchMethodDescriptions
+extends Filter
+{
+
+private final List filters = new ArrayList();
+
+MatchMethodDescriptions( Iterable descriptions )
+{
+for ( Description description : descriptions )
+{
+filters.add( matchMethodDescription ( description ) );
+}
+}
+
+@Override
+public boolean shouldRun( Description description )
+{
+for ( Filter filter : filters )
--- End diff --

This loop is different from the deleted class but I need to have spare time 
to have deep looking.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136932256
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/MatchMethodDescriptions.java
 ---
@@ -0,0 +1,74 @@
+package org.apache.maven.surefire.common.junit48;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Only run test methods in the given failure set
+ *
+ * @author mpkorstanje
+ */
+final class MatchMethodDescriptions
+extends Filter
+{
+
+private final List filters = new ArrayList();
+
+MatchMethodDescriptions( Iterable descriptions )
+{
+for ( Description description : descriptions )
+{
+filters.add( matchMethodDescription ( description ) );
+}
+}
+
+@Override
+public boolean shouldRun( Description description )
+{
+for ( Filter filter : filters )
+{
+if ( filter.shouldRun( description ) )
+{
+return true;
+}
+}
+return false;
+}
+
+@Override
+public String describe()
+{
+StringBuilder description = new StringBuilder( "Matching 
description " );
+for ( int i = 0; i < filters.size(); i++ )
+{
+description.append( filters.get( i ).describe() );
+if ( i != filters.size() - 1 )
+{
+description.append( " OR " );
+}
+}
+return description.toString();
+}
+}
--- End diff --

Here a new line should be added.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136932062
  
--- Diff: 
surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FailingMethodFilter.java
 ---
@@ -1,85 +0,0 @@
-package org.apache.maven.surefire.common.junit48;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.shared.utils.io.SelectorUtils;
-import org.junit.runner.Description;
-import org.junit.runner.manipulation.Filter;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Only run test methods in the given input map, indexed by test class
- */
-final class FailingMethodFilter
--- End diff --

I don't think this can be removed. I have to check the algorithms of 
FailingMethodFilter and MatchMethodDescriptions.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136931552
  
--- Diff: 
surefire-integration-tests/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml
 ---
@@ -0,0 +1,88 @@
+
+
+
+http://maven.apache.org/POM/4.0.0;
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
+4.0.0
+
+
+org.apache.maven.surefire
+it-parent
+1.0
+
+
+junit47-rerun-failing-tests-with-cucumber
+jar
+
+Test for rerun failing cucumber tests in JUnit 47
+
+
+2.0.0-SNAPSHOT
--- End diff --

This too.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136931515
  
--- Diff: 
maven-surefire-plugin/src/site/apt/examples/rerun-failing-tests.apt.vm ---
@@ -140,10 +140,14 @@ mvn 
-D${thisPlugin.toLowerCase()}.rerunFailingTestsCount=2 test
   The provider <<>> executes individual test class and 
consequently re-runs failed tests.
   The provider <<>> executes all test classes and 
re-runs failed tests afterwards.
 
+* Re-run execution in Cucumber JVM
+
+  Since of 2.21 the provider <<>> can rerun scenarios 
created by <>
+  2.0.0-SNAPSHOT and higher.
--- End diff --

Pls change to 2.0.0 without SNAPSHOT.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-09-05 Thread Tibor17
Github user Tibor17 commented on a diff in the pull request:

https://github.com/apache/maven-surefire/pull/150#discussion_r136931399
  
--- Diff: 
surefire-integration-tests/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml
 ---
@@ -0,0 +1,88 @@
+
+
+
+http://maven.apache.org/POM/4.0.0;
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
+4.0.0
+
+
+org.apache.maven.surefire
+it-parent
+1.0
+
+
+junit47-rerun-failing-tests-with-cucumber
+jar
+
+Test for rerun failing cucumber tests in JUnit 47
+
+
+2.0.0-SNAPSHOT
+
+
+
+
+
+org.apache.maven.plugins
+maven-surefire-plugin
+${surefire.version}
+
+
+org.apache.maven.surefire
+surefire-junit47
+${surefire.version}
+
+
+
+
+
+
+
+
+junit
+junit
+${junit.version}
+test
+
+
+io.cucumber
+cucumber-java
+${cucumber.version}
+test
+
+
+io.cucumber
+cucumber-junit
+${cucumber.version}
+test
+
+
+
+
--- End diff --

This can be removed.


---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org



[GitHub] maven-surefire pull request #150: SUREFIRE-1372 Filter tests to be rerun by ...

2017-05-26 Thread mpkorstanje
GitHub user mpkorstanje opened a pull request:

https://github.com/apache/maven-surefire/pull/150

SUREFIRE-1372 Filter tests to be rerun by description

 Filtering tests by the tuple of (Class, Method) does not work when a test
 suite is used as a suite may not have (Class, Method) . Filtering by the
 description of the failed test should however work.

 Related Issues:
 - https://github.com/cucumber/cucumber-jvm/issues/1120
 - https://github.com/temyers/cucumber-jvm-parallel-plugin/issues/31

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mpkorstanje/maven-surefire SUREFIRE-1372

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/maven-surefire/pull/150.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #150


commit 0ede21cb929df8004f065db82304061e0e0929d5
Author: mpkorstanje 
Date:   2017-05-10T21:59:31Z

SUREFIRE-1372 Filter tests to be rerun by description

 Filtering tests by the tuple of (Class, Method) does not work when a test
 suite is used as a suite may not have (Class, Method) . Filtering by the
 description of the failed test should however work.

 Related Issues:
 - https://github.com/cucumber/cucumber-jvm/issues/1120
 - https://github.com/temyers/cucumber-jvm-parallel-plugin/issues/31




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org