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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Tibor17-2
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 <[hidden email]>
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Tibor17-2
Github user mpkorstanje commented on the issue:

    https://github.com/apache/maven-surefire/pull/150
 
    All done. Tests are running against `cucumber-java:2.0.0-SNAPSHOT`


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Tibor17-2
In reply to this post by Tibor17-2
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/150
 
    ok, take your time. No worries. Just rebase the PR after your team finished the release. Surefire need some week to make release as well.


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Tibor17-2
In reply to this post by Tibor17-2
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Tibor17-2
In reply to this post by Tibor17-2
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<Filter> filters = new ArrayList<Filter>();
    +
    +    MatchMethodDescriptions( Iterable<Description> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Tibor17-2
In reply to this post by Tibor17-2
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<Filter> filters = new ArrayList<Filter>();
    +
    +    MatchMethodDescriptions( Iterable<Description> 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: [hidden email]
For additional commands, e-mail: [hidden email]