You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/05/11 17:27:52 UTC
[GitHub] [maven-surefire] Tibor17 opened a new pull request #350: Surefire 1910
Tibor17 opened a new pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-838873054
@laeubi
Pls comment every commit. Thx
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] laeubi commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r631563007
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
This looks good to me and is much more clearer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r632103181
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
I am also to 100% convinced about the names. It must depict the real meaning of usage in the code, as the one above. Feel free to propose better ones.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-840015674
yeah, the field I deleted in `ProviderConfiguration` and `DirectoryScannerParameters` was not used in Surefire Provider.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 edited a comment on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 edited a comment on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-839857254
@laeubi
We have to find the best names for the enums but first of all we have to realize that `getEffectiveFailIfNoTests()` is called if an error happens. The fact that this method is called at the line [1892](https://github.com/apache/maven-surefire/blob/827edf4c6bdad7892a768d1605b74b1258b27369/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1892) and the value is not used in the forked JVM and the value is passed to a [setter](https://github.com/apache/maven-surefire/blob/827edf4c6bdad7892a768d1605b74b1258b27369/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1893) means that it is a hack. The field `failIfNoTests` is old one and carries a processed information from two fields. This is bad. I am not wondering that then the method `getEffectiveFailIfNoTests()` is misleading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r631486340
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
It could be named `TestRunExpectation` in terms of positive outcome from the plugin execution.
Now the enum is used only in the method `getEffectiveFailIfNoTests()` and this method evaluates two config parameter if no tests were executed. So it is negative result of the plugin, see this:
```
DefaultScanResult scan = scanForTestClasses();
if ( !hasSuiteXmlFiles() && scan.isEmpty() )
{
switch ( getEffectiveFailIfNoTests() )
{
case NO_TESTS_RUN:
throw new MojoFailureException(
"No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)" );
case NO_SPECIFIED_TESTS_RUN:
throw new MojoFailureException( "No tests matching pattern \""
+ getSpecificTests().toString()
+ "\" were executed! (Set "
+ "-D" + getPluginName() + ".failIfNoSpecifiedTests=false to ignore this error.)" );
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r632103181
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
I am also to 100% convinced about the names. They must depict the real meaning of usage in the code, as the one above. Feel free to propose better ones.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r631486340
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
It could be named `TestRunExpectation` in terms of positive outcome from the plugin execution.
Now the enum is used only in the method `getEffectiveFailIfNoTests()` and this method evaluates two config parameter if no tests were executed. So it is negative result of the plugin, see this:
```
DefaultScanResult scan = scanForTestClasses();
if ( !hasSuiteXmlFiles() && scan.isEmpty() )
{
switch ( getEffectiveFailIfNoTests() )
{
case NO_TESTS_RUN:
throw new MojoFailureException(
"No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)" );
case NO_SPECIFIED_TESTS_RUN:
throw new MojoFailureException( "No tests matching pattern \""
+ getSpecificTests().toString()
+ "\" were executed! (Set "
+ "-D" + getPluginName() + ".failIfNoSpecifiedTests=false to ignore this error.)" );
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r632795790
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
Pls check the names of enum now, see the [commit](https://github.com/apache/maven-surefire/pull/350/commits/3e8c22489648e06a520771c5b857088bad0e565b).
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
+ {
+ NO_FAILURE,
Review comment:
Pls check the names of enum now, see the [commit](https://github.com/apache/maven-surefire/pull/350/commits/3e8c22489648e06a520771c5b857088bad0e565b).
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
+ {
+ NO_FAILURE,
+ NO_SPECIFIED_TESTS_RUN,
Review comment:
Pls check the names of enum now, see the [commit](https://github.com/apache/maven-surefire/pull/350/commits/3e8c22489648e06a520771c5b857088bad0e565b).
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
+ {
+ NO_FAILURE,
+ NO_SPECIFIED_TESTS_RUN,
+ NO_TESTS_RUN,
Review comment:
Pls check the names of enum now, see the [commit](https://github.com/apache/maven-surefire/pull/350/commits/3e8c22489648e06a520771c5b857088bad0e565b).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 edited a comment on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 edited a comment on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-840015674
yeah, the field I deleted in `ProviderConfiguration` and `DirectoryScannerParameters` was not used in Surefire Provider. So the method `getEffectiveFailIfNoTests()` is called just only once.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-839857254
@laeubi
We have to find the best names for the enums but first of all we have to realize that `getEffectiveFailIfNoTests()` is called if an error happens. The fact that this method is called at the line [1892](https://github.com/apache/maven-surefire/blob/827edf4c6bdad7892a768d1605b74b1258b27369/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1892) and the value is not used in the forked JVM and the value is passed to a [setter](https://github.com/apache/maven-surefire/blob/827edf4c6bdad7892a768d1605b74b1258b27369/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L1893) means that it is a hack. The field `failIfNoTests` is old one and carries processed information from two fields. This is bad. I am not wondering that then the method `getEffectiveFailIfNoTests()` is misleading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] laeubi commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r630717850
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
Maybe it is better to get away from all this "NOs" I think "TestRunExpectation" or something similar might be better here ...
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
+ {
+ NO_FAILURE,
+ NO_SPECIFIED_TESTS_RUN,
Review comment:
... SPECIFIED_TESTS_RUN here...
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
+ {
+ NO_FAILURE,
Review comment:
and then "NONE" here ...
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
+ {
+ NO_FAILURE,
+ NO_SPECIFIED_TESTS_RUN,
+ NO_TESTS_RUN,
Review comment:
... and finally "ANY_TESTS_RUN" or "ATLAEST_ONE_TEST" here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] laeubi commented on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-839906053
Sure that was just an idea, don't know if it "helps" to make this less confusing :-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#discussion_r631486340
##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
##########
@@ -4215,4 +4213,14 @@ private Classpath setCachedClasspath( @Nonnull String key, @Nonnull Set<Artifact
return classpath;
}
}
+
+ /**
+ * No tests run failures.
+ */
+ enum NoTestsFailureReason
Review comment:
It could be named `TestRunExpectation` in terms of positive outcome from the plugin execution.
Now the enum is used only in the method `getEffectiveFailIfNoTests()` and this method evaluates two config parameter if no tests were executed. So it is negative result of the plugin, see this:
```
DefaultScanResult scan = scanForTestClasses();
if ( !hasSuiteXmlFiles() && scan.isEmpty() )
{
switch ( getEffectiveFailIfNoTests() )
{
case NO_TESTS_RUN:
throw new MojoFailureException(
"No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)" );
case NO_SPECIFIED_TESTS_RUN:
throw new MojoFailureException( "No tests matching pattern \""
+ getSpecificTests().toString()
+ "\" were executed! (Set "
+ "-D" + getPluginName() + ".failIfNoSpecifiedTests=false to ignore this error.)" );
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 commented on pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350#issuecomment-838872459
@laeubi
I created this pullrequest. You are welcome!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-surefire] Tibor17 merged pull request #350: Surefire 1910
Posted by GitBox <gi...@apache.org>.
Tibor17 merged pull request #350:
URL: https://github.com/apache/maven-surefire/pull/350
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org