Faisalfe JUNIT RunListener

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Faisalfe JUNIT RunListener

Petar Tahchiev
Hey guys,

so I've been playing with JUnit's RunListener lately. Here's my RunListener:

public class MockMvcRestRunListener extends RunListener {

    private static final Logger LOG =
LoggerFactory.getLogger(AbstractFacadeRestIntegrationTest.class);

    public static Map<String, List<String>> documentations = new HashMap<>();

    @Override
    public void testRunFinished(Result result) throws Exception {
        System.out.println("Finished = ");
    }
}

and I declare it in my failsafe plugin (as described here:
http://maven.apache.org/surefire/maven-failsafe-plugin/examples/junit.html)
by adding this:

    <properties>
        <property>
            <name>listener</name>
            <value>com.nemesis.platform.facade.test.MockMvcRestRunListener</value>
        </property>
    </properties>
</configuration>

One think I notice when I add this RunListener is that failsafe now shows
wrong results:

BEFORE:
---------
Results :

Tests run: 134, Failures: 0, Errors: 0, Skipped: 6
---------

AFETR:
---------
Results :

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

Also, now that I add the RunListener, my log output is prefixed with
SUREFIRE-859:, for example:

SUREFIRE-859: 2017-06-14 08:05:24,635 [Thread-8] INFO : Channel
'application:test:-1.errorChannel' has 0 subscriber(s).
SUREFIRE-859: 2017-06-14 08:05:24,635 [Thread-8] INFO : stopped
_org.springframework.integration.errorLogger
SUREFIRE-859: 2017-06-14 08:05:24,637 [Thread-8] INFO : Shutting down
ExecutorService 'messageBrokerTaskScheduler'
SUREFIRE-859: 2017-06-14 08:05:24,638 [Thread-8] INFO : Shutting down
ExecutorService 'brokerChannelExecutor'
SUREFIRE-859: 2017-06-14 08:05:24,638 [Thread-8] INFO : Shutting down
ExecutorService 'redisTaskExecutor'

Why is that ???

My configuration is:
---------
petar@petar-XPS-15-9550:~/workspace/nemesis-platform/nemesis-platform-facade$
mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426;
2017-04-03T22:39:06+03:00)
Maven home: /usr/share/maven/apache-maven-3.5.0
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-79-generic", arch: "amd64", family: "unix"
---------

And second, even more important is. When I try to change my RunListener to
use the Slf4j LOG,

instead of System.out.println, my tests always fail with:

-------
Results :

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

[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 47.629 s
[INFO] Finished at: 2017-06-14T08:27:31+03:00
[INFO] Final Memory: 236M/1173M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test
(default) on project nemesis-platform-facade: Execution default of goal
org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test
failed: The forked VM terminated without properly saying goodbye. VM crash
or System.exit called?
[ERROR] Command was /bin/sh -c cd
/home/petar/workspace/nemesis-platform/nemesis-platform-facade &&
/usr/lib/jvm/java-8-oracle/jre/bin/java -Xms512m -Xmx3072m
-Dfile.encoding=UTF-8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly
-XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC
-XX:+HeapDumpOnOutOfMemoryError
org.apache.maven.surefire.booter.ForkedBooter
/home/petar/workspace/nemesis-platform/nemesis-platform-facade/target/surefire/surefire3867035074322911074tmp
/home/petar/workspace/nemesis-platform/nemesis-platform-facade/target/surefire/surefire_05312973455230549032tmp
[ERROR] -> [Help 1]
-------

Any idea what's happening?
--
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Faisalfe JUNIT RunListener

Petar Tahchiev
Hi guys,

reporting back. This seems to be an issue in  maven-failsafe-plugin:2.18.1
After I update the version to 2.20 it works fine.

2017-06-14 8:29 GMT+03:00 Petar Tahchiev <[hidden email]>:

> Hey guys,
>
> so I've been playing with JUnit's RunListener lately. Here's my
> RunListener:
>
> public class MockMvcRestRunListener extends RunListener {
>
>     private static final Logger LOG = LoggerFactory.getLogger(AbstractFacadeRestIntegrationTest.class);
>
>     public static Map<String, List<String>> documentations = new HashMap<>();
>
>     @Override
>     public void testRunFinished(Result result) throws Exception {
>         System.out.println("Finished = ");
>     }
> }
>
> and I declare it in my failsafe plugin (as described here: http://maven.apache.org/surefire/maven-failsafe-plugin/examples/junit.html) by adding this:
>
>     <properties>
>         <property>
>             <name>listener</name>
>             <value>com.nemesis.platform.facade.test.MockMvcRestRunListener</value>
>         </property>
>     </properties>
> </configuration>
>
> One think I notice when I add this RunListener is that failsafe now shows
> wrong results:
>
> BEFORE:
> ---------
> Results :
>
> Tests run: 134, Failures: 0, Errors: 0, Skipped: 6
> ---------
>
> AFETR:
> ---------
> Results :
>
> Tests run: 5, Failures: 0, Errors: 0, Skipped: 5
> ---------
>
> Also, now that I add the RunListener, my log output is prefixed with
> SUREFIRE-859:, for example:
>
> SUREFIRE-859: 2017-06-14 08:05:24,635 [Thread-8] INFO : Channel
> 'application:test:-1.errorChannel' has 0 subscriber(s).
> SUREFIRE-859: 2017-06-14 08:05:24,635 [Thread-8] INFO : stopped
> _org.springframework.integration.errorLogger
> SUREFIRE-859: 2017-06-14 08:05:24,637 [Thread-8] INFO : Shutting down
> ExecutorService 'messageBrokerTaskScheduler'
> SUREFIRE-859: 2017-06-14 08:05:24,638 [Thread-8] INFO : Shutting down
> ExecutorService 'brokerChannelExecutor'
> SUREFIRE-859: 2017-06-14 08:05:24,638 [Thread-8] INFO : Shutting down
> ExecutorService 'redisTaskExecutor'
>
> Why is that ???
>
> My configuration is:
> ---------
> petar@petar-XPS-15-9550:~/workspace/nemesis-platform/nemesis-platform-facade$
> mvn -version
> Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426;
> 2017-04-03T22:39:06+03:00)
> Maven home: /usr/share/maven/apache-maven-3.5.0
> Java version: 1.8.0_131, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/java-8-oracle/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.4.0-79-generic", arch: "amd64", family:
> "unix"
> ---------
>
> And second, even more important is. When I try to change my RunListener to
> use the Slf4j LOG,
>
> instead of System.out.println, my tests always fail with:
>
> -------
> Results :
>
> Tests run: 5, Failures: 0, Errors: 0, Skipped: 5
>
> [INFO] ------------------------------------------------------------
> ------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------
> ------------
> [INFO] Total time: 47.629 s
> [INFO] Finished at: 2017-06-14T08:27:31+03:00
> [INFO] Final Memory: 236M/1173M
> [INFO] ------------------------------------------------------------
> ------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:
> maven-failsafe-plugin:2.18.1:integration-test (default) on project
> nemesis-platform-facade: Execution default of goal org.apache.maven.plugins:
> maven-failsafe-plugin:2.18.1:integration-test failed: The forked VM
> terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was /bin/sh -c cd /home/petar/workspace/nemesis-
> platform/nemesis-platform-facade && /usr/lib/jvm/java-8-oracle/jre/bin/java
> -Xms512m -Xmx3072m -Dfile.encoding=UTF-8 -XX:+UseParNewGC
> -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly
> -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -XX:+HeapDumpOnOutOfMemoryError
> org.apache.maven.surefire.booter.ForkedBooter
> /home/petar/workspace/nemesis-platform/nemesis-platform-
> facade/target/surefire/surefire3867035074322911074tmp
> /home/petar/workspace/nemesis-platform/nemesis-platform-
> facade/target/surefire/surefire_05312973455230549032tmp
> [ERROR] -> [Help 1]
> -------
>
> Any idea what's happening?
> --
> Regards, Petar!
> Karlovo, Bulgaria.
> ---
> Public PGP Key at: http://pgp.mit.edu:11371/pks/lookup?op=get&search=
> 0x19658550C3110611
> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>



--
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
Loading...