1

I am running IntelliJ IDEA 2018.3.1 and am attempting test a class with the integrated test runner. The test seems to compile but not run.

This is a multi-module Maven project, and other modules have tests that run. However, I have not been able to find any differences between the projects. The surefire plugin is specifically defined on this project, and <skipTests> is specifically set to false. I have reimported the project several times in case the maven configuration is affecting the built-in runner.

The image below is the only output I get. Debug/Breakpoints will not stop.

enter image description here

If anyone can help or throw possibilities at me, I would appreciate it.

Edit:

Here's a simplified version of the test I'm attempting to run:

package com.jason;

// imports

@RunWith(BlockJUnit4TestRunner.class)
public class MyTest {

    private ClassUnderTest clazz;

    private DaoClass dao;

    @Before
    public void setUp() {
       // using Mockito to mock the DaoClass

       // injecting the DAO into the ClassUnderTest
    }

    @Test
    public void testMethod() {

        Assert.assertTrue(true);
    }
}

I attempt to run the test by right-clicking on the method annotated with @Test and clicking run. The option to run the test DOES appear in the context menu. When I do so, all that appears is the screenshot.

I have attempted to do the following to troubleshoot the issue:

    • In the pom.xml file for the appropriate module, I have manually specified the surefire plugin in the <build><plugins> section. I then did a reimport to pick up the changes.
  • I have put breakpoints in the code and run the test in debug mode.
  • I have attempted to log output, both with an slf4j logger and a System.out.println()
  • I have attempted to find any differences in the IDEA .iml file between a module where the tests run and this module where the tests do not run.
  • I have written a very simple test class, with a method annotated with @Test and containing the line Assert.assertTrue(true)

Edit 2 Attempting to run mvn test -Dcontrollername produces the following output:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project rma-svc: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

Edit 3

I've updated my Maven surefire plugin to 2.22.2 and am not seeing the forked JVM issue any longer. However, running mvn test -DskipTests=false outputs No tests were executed!

Jason
  • 3,943
  • 12
  • 64
  • 104
  • Have you tried to ensure the code is actually being ran by including some kind of logging in your test methods? – Matthew Jun 04 '19 at 14:55
  • Yes, I have, both with a regular logger and a System.out.println() – Jason Jun 04 '19 at 14:58
  • And I am assuming you've actually tried running the test in debug mode and tried to assert simple conditions that you knew were gonna fail the test? – Matthew Jun 04 '19 at 15:01
  • Yes, did that too. It never displays the output pane, as described as #4 on this link: https://www.jetbrains.com/help/idea/test-runner-tab.html – Jason Jun 04 '19 at 15:03
  • Would be great if you could include everything you've tried so far in the question so we don't have to chat in the comments like this. – Matthew Jun 04 '19 at 15:05
  • See edited post – Jason Jun 04 '19 at 15:20
  • Have you tried running `mvn test` manually? – dan1st Jun 04 '19 at 15:21
  • You said you tried to make it fail. Try to flip you assertion to false and see if the test fails. – Matthew Jun 04 '19 at 15:23
  • I'm unable to run maven from the command line due to a separate issue. – Jason Jun 04 '19 at 15:28
  • Attempting to run `Assert.assertFalse(true)` did not produce any test output. – Jason Jun 04 '19 at 15:29
  • Perhaps see if this helps: https://stackoverflow.com/a/51852779/5759072 – Matthew Jun 04 '19 at 15:43
  • I've updated again with the output of `mvn test` from the command line. I don't know if this affects the IntelliJ issue or not. – Jason Jun 04 '19 at 17:00
  • @Jason Does that mean your issue was resolved then? – Matthew Jun 04 '19 at 23:03
  • No, the issue is not resolved. I cannot run the tests in IntelliJ or via the command line. For ease of use, I would rather use the IntelliJ runner. – Jason Jun 04 '19 at 23:04
  • I had the same with intellij, it is due to an old version of the sure fire plugin if you are running locally java 11 – Paizo Jun 05 '19 at 08:17
  • I've updated my surefire plugin to 2.22.2, which is the most recent. I'm also only using a Java 8 JDK. – Jason Jun 05 '19 at 10:32
  • Please tell if the issue is reproduced with IDEA 2019.1.3? Can it be reproduced with little sample project? If yes, please share. – Olga Klisho Jun 05 '19 at 12:21
  • @OlgaKlisho: I have asked this question in the community forum as well. https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003952660-TestRunner-Doesn-t-Run-JUnit-Tests . I am starting to think this is a carryover from the original import of the maven project into the IDEA project. I will check if the problem occurs in 2018.3.6, but I have to ask my IT people if my license covers 2019. – Jason Jun 05 '19 at 12:30

0 Answers0