This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 247058 - Unit-Test-Results are not displayed in TestResult-Tab
Summary: Unit-Test-Results are not displayed in TestResult-Tab
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Test Runner (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-12 07:05 UTC by ch.thiel
Modified: 2014-09-26 11:56 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshots (15.02 KB, application/force-download)
2014-09-12 07:05 UTC, ch.thiel
Details
maven-project (9.49 KB, application/force-download)
2014-09-19 14:14 UTC, ch.thiel
Details
Surefire-reports (2.02 KB, application/force-download)
2014-09-22 06:02 UTC, ch.thiel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ch.thiel 2014-09-12 07:05:05 UTC
Created attachment 149163 [details]
Screenshots

Product Version = NetBeans IDE 8.0.1 (Build 201408251540)
Operating System = Linux version 3.13.0-35-generic running on amd64
Java; VM; Vendor = 1.8.0
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.0-b70

Unit-Test-Results are not displayed in TestResult-Tab. 
Instead only 'No tests executed' is diplayed - but the test was executed, as can be seen in console.

Occures on every maven-project.
Comment 1 ch.thiel 2014-09-17 10:01:25 UTC
It seems to work, as long at least one test of the test-class fails (correct number of passed/failed tests are shown in test-result-tab).
Only if all tests of the test-class pass, 'no tests executed' is displayed in the test-result-tab.
Comment 2 Theofanis Oikonomou 2014-09-19 10:15:50 UTC
I am sorry but I cannot reproduce in NetBeans IDE 8.0.1 (Build 201408251540). Results are correctly shown in Test Results Window when all tests pass and/or there are some failures. I am assuming you are using junit. This sounds similar with bug 224442 whose fix is included in 8.0.1. Please reopen describing any special setup, exact steps to reproduce, attaching pom file and ideally a maven-project for which you can reproduce the issue. Thank you for reporting
Comment 3 ch.thiel 2014-09-19 14:14:15 UTC
Created attachment 149370 [details]
maven-project

Added a maven-project with a junit-test.
In the test-class there are two test-methods.
If at least one test is altered so it will fail, the testresult is displayed correctly.
If all tests pass, in the test-tab 'No Tests executed' is displayed.
tried with
junit 4.10 and 4.11
and
surefire 2.12.2 and 2.17
(see pom.xml)
Comment 4 Theofanis Oikonomou 2014-09-19 14:34:27 UTC
Thank you for the input. Investigating
Comment 5 Theofanis Oikonomou 2014-09-19 15:07:53 UTC
when running in 8.0.1 as well as today's dev build I am getting the following

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Concurrency config is parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Running com.example.CalculatorTest
Exception in thread "ThreadedStreamConsumer" java.lang.NoSuchMethodError: org.apache.maven.surefire.report.StackTraceWriter.getThrowable()Ljava/lang/Throwable;
	at org.apache.maven.surefire.report.XMLReporter.writeTestProblems(XMLReporter.java:272)
	at org.apache.maven.surefire.report.XMLReporter.testFailed(XMLReporter.java:249)
	at org.apache.maven.surefire.report.MulticastingReporter.testFailed(MulticastingReporter.java:80)
	at org.apache.maven.surefire.report.TestSetRunListener.testFailed(TestSetRunListener.java:157)
	at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:106)
	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:67)
	at java.lang.Thread.run(Thread.java:744)

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.738s
Finished at: Fri Sep 19 17:06:40 CEST 2014
Final Memory: 7M/232M
------------------------------------------------------------------------

is this the case with you too?
Comment 6 ch.thiel 2014-09-22 06:02:41 UTC
Created attachment 149403 [details]
Surefire-reports

Aadded surefire-reports and console-output created by a run on CalculatorTest with only one Test 'shouldAddCorrectly' - Test is executed and passed (as you can see in console).
Test-Tab  still displays 'No Test executed'
Comment 7 ch.thiel 2014-09-22 06:03:02 UTC
cd /home/christiant/NetBeansProjects/example; JAVA_HOME=/opt/java/jdk/1.8.0 M2_HOME=/opt/apache/maven/3.0.5 /opt/apache/maven/3.0.5/bin/mvn -Dtest=com.example.CalculatorTest --errors --fail-fast -V -e -Dcom.itac.persistence.DataSourceQueryAnalizer.enabled=true surefire:test
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /opt/apache/maven/3.0.5
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /opt/java/jdk/1.7.0_55/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-35-generic", arch: "amd64", family: "unix"
Error stacktraces are turned on.
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building example 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-surefire-plugin:2.10:test (default-cli) @ example ---
Surefire report directory: /home/christiant/NetBeansProjects/example/target/surefire-reports
Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Concurrency config is parallel='none', perCoreThreadCount=true, threadCount=2, useUnlimitedThreads=false
Running com.example.CalculatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.271s
Finished at: Mon Sep 22 07:57:09 CEST 2014
Final Memory: 8M/240M
------------------------------------------------------------------------
Comment 8 Theofanis Oikonomou 2014-09-26 11:26:44 UTC
It is strange. In my machine I am always getting the exception from comment 5. So I cannot reproduce. Interestingly though if I modify your pom I get the expected behavior. What I did was to remove everything between <pluginManagement> tags and replace it with the following: 


<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
            <parallel>none</parallel>
            <forkMode>pertest</forkMode>
        </configuration>
    </plugin>
</plugins>

Can you check if this works for you?

This is what I get in the output window:

cd /Users/fanis/Downloads/example; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.app/Contents/Resources/NetBeans/java/maven/bin/mvn" test
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building example 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-resources-plugin:2.5:resources (default-resources) @ example ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 0 resource

--- maven-compiler-plugin:2.3.2:compile (default-compile) @ example ---
Nothing to compile - all classes are up to date

--- maven-resources-plugin:2.5:testResources (default-testResources) @ example ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /Users/fanis/Downloads/example/src/test/resources

--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ example ---
Nothing to compile - all classes are up to date

--- maven-surefire-plugin:2.17:test (default-test) @ example ---
The parameter forkMode is deprecated since version 2.14. Use forkCount and reuseForks instead.
Surefire report directory: /Users/fanis/Downloads/example/target/surefire-reports
parallel='none', perCoreThreadCount=true, threadCount=0, useUnlimitedThreads=false, threadCountSuites=0, threadCountClasses=0, threadCountMethods=0, parallelOptimized=true

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.example.CalculatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in com.example.CalculatorTest

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.867s
Finished at: Fri Sep 26 13:20:40 CEST 2014
Final Memory: 8M/232M
------------------------------------------------------------------------
Comment 9 ch.thiel 2014-09-26 11:56:12 UTC
Up to now the dependency to the surefire-plugin was defined as follows:
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <parallel>none</parallel>
          <forkMode>pertest</forkMode>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit47</artifactId>
            <version>2.17</version>
          </dependency>
        </dependencies>
      </plugin>

Leaving the dependecy-section of the plugin as follows (suggested by Theofanis), the testresults are correctly displayed!
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <parallel>none</parallel>
          <forkMode>pertest</forkMode>
        </configuration>
      </plugin>

That works for me - Thank you!