-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SUREFIRE-2010] Parameterized Selection Does not Work #476
Open
DaGeRe
wants to merge
4
commits into
apache:master
Choose a base branch
from
DaGeRe:surefire-2010
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
.../org/apache/maven/surefire/its/jiras/Surefire2010ParameterizedSelectionDoesNotWorkIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.apache.maven.surefire.its.jiras; | ||
|
||
/* | ||
* 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.surefire.its.fixture.OutputValidator; | ||
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; | ||
import org.apache.maven.surefire.its.fixture.TestFile; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-2010">SUREFIRE-2010</a> | ||
*/ | ||
public class Surefire2010ParameterizedSelectionDoesNotWorkIT | ||
extends SurefireJUnit4IntegrationTestCase | ||
{ | ||
@Test | ||
public void testJUnit4() | ||
{ | ||
OutputValidator validator = unpack( "surefire-2010-parameterized-selection-does-not-work" ).executeTest(); | ||
TestFile surefireReportsFile = validator.getSurefireReportsFile( "de.dagere.peass.ExampleTestJUnit4.txt" ); | ||
surefireReportsFile.assertContainsText( "Tests run: 2" ); | ||
} | ||
|
||
public void testJUnit5() | ||
{ | ||
|
||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
--> | ||
<project xmlns="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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.maven.surefire</groupId> | ||
<artifactId>it-parent</artifactId> | ||
<version>1.0</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<groupId>org.apache.maven.plugins.surefire</groupId> | ||
<artifactId>jiras-surefire-2010</artifactId> | ||
<version>1.0</version> | ||
<url>http://maven.apache.org</url> | ||
<developers> | ||
<developer> | ||
<id>DaGeRe</id> | ||
<name>David Georg Reichelt (DaGeRe)</name> | ||
<email>[email protected]</email> | ||
<roles> | ||
<role>Committer</role> | ||
</roles> | ||
<timezone>Europe/Berlin</timezone> | ||
</developer> | ||
</developers> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<version>5.8.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<forkMode>once</forkMode> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
39 changes: 39 additions & 0 deletions
39
...arameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit4.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.dagere.peass; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
@RunWith( Parameterized.class ) | ||
public class ExampleTestJUnit4 | ||
{ | ||
|
||
@Parameters | ||
public static Collection<Object[]> data() | ||
{ | ||
return Arrays.asList( new Object[][] { { 0 }, { 1 } } ); | ||
} | ||
|
||
int value; | ||
|
||
public ExampleTestJUnit4( int value ) | ||
{ | ||
this.value = value; | ||
} | ||
|
||
@Test | ||
public void test() | ||
{ | ||
System.out.println( value ); | ||
} | ||
|
||
@Test | ||
public void anotherTest() | ||
{ | ||
System.out.println( "3 (and value ignored)" ); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...arameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit5.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package de.dagere.peass; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
public class ExampleTestJUnit5 | ||
{ | ||
|
||
@ParameterizedTest | ||
@ValueSource( ints = { 0, 1 } ) | ||
public void test( final int value ) | ||
{ | ||
System.out.println( value ); | ||
} | ||
|
||
@Test | ||
public void anotherTest() | ||
{ | ||
System.out.println( "3" ); | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to this parent POM specifies
<forkMode>never</forkMode>
it is a problem for all ITs and the tests won't run in a fork mode. There are two alternatives how to solve this. Override the parameter to the default value<forkMode>once</forkMode>
or use<version>${surefire.version}</version>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've added the
forkMode
.