You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2020/04/16 22:14:00 UTC

[jira] [Commented] (SUREFIRE-1776) DefaultReportFactory doesn't report errors when engine fails

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

Tibor Digana commented on SUREFIRE-1776:
----------------------------------------

It could simply happen tht the JUnit description of a test failed.
Check it out with the development version 3.0.0-SNAPSHOT and use the plugin repo in your POM:

{code:xml}
<pluginRepository>
  <id>surefire-snapshot</id>
  <name>surefire-snapshot</name>
  <url>https://repository.apache.org/content/repositories/snapshots/</url>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
 </pluginRepository
{code}

The OSGi frameworks are special. You can enable the TCP communication between Surefire processes and Maven process but this would be later step.

Meanwhile pls let me know how it goes with the snapshot version.

> DefaultReportFactory doesn't report errors when engine fails
> ------------------------------------------------------------
>
>                 Key: SUREFIRE-1776
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1776
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.22.0
>            Reporter: Mickael Istria
>            Priority: Major
>
> We face an issue with tycho-surefire-plugin reporting "No tests found" when a test is actually found but the engine fails (for a tycho-specific reason) when preparing the test.
> tycho-surefire-plugin basically builds an OSGi container as defined in the usual Tycho way and uses Surefire API to run the tests inside that container and report it as a plain surefire does regularly.
> To do so, it does mainly uses `RunResult result = ProviderFactory.invokeProvider(...)`. However, it can happen that an error happen in the engine, before any test method starts (although the test method is scanned and detected and an executionRequest is emitted for it). The cases for it are relatively probable with Tycho/OSGi.
>  In such case, even if the engine faced an error, we get a RunResult mentioning no error, actually reporting no test execution, but no error, usually making the test report say everything is fine or telling "No tests found" (which is also incorrect because test is found, it could not just be started).
> I could dig a bit more and I think the DefaultTestReporter.mergeTestHistoryResult() method just fails at handling the cases of errors when the error do not happen on the test method, because it wrongly assumes that `listener.getTestMethodStats()` is exhaustive.
>  More specifically, when debugging this method, I do see in debugger that `this.listeners[0].detailsForThis` has `completedCount==1` and `errors==1` but the return value says completedCount==0 and errors=0; its reportEntries show one error entry, which has for source `<unrooted>` so they're not returned by `listener.getTestMethodStats()`.
> I believe the DefaultReportFactory should handle the case to verify before returning whether such unrooted error wasn't missed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)