TestRunner Doesn't Run JUnit Tests

Answered

Version: 2018.3.1

I have a multi-module maven project, and am attempting to run a Junit 4 test from the integrated test runner. All tests are annotated with @Test, but upon running, the only output I get is below.

I am also currently unable to run the test from the command line via "mvn test". The most current surefire plugin only says "No tests run!", even specifying -DskipTests=false. I don't know if these issues are related.

 

Things I have tried:

- I have put logging statements in my code, both with our logging implementation and with System.out.println().

- I have run my tests in debug mode, with random breakpoints set.

- I've written a VERY simple test with the contents "Assert.assertTrue(false)"

 

I honestly don't know what to do next.

0
3 comments

It looks like your project is misconfigured, like tests are not in the test source roots. We can help if you provide a sample project to reproduce it: https://uploads.services.jetbrains.com/ .

0
Avatar
Permanently deleted user

I'll try to throw together a sample project, but I don't know if it will work. This is compounded by being a multi-module project (more than 8 modules) and of those 8 modules, the tests in one of them works. I was only able to find one difference between the working module and the one I am working in: the maven surefire plugin was defined under <build><pluginManagement> instead of just <plugins>. However, changing that did not fix the issue.

 

Also, I cannot build via maven at the command line. While obviously maven command line issues are not your problem, I provide this information on the chance it is related.

 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project common: 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?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" org.apache.maven.surefire.booter.ForkedBooter C:\Development\app\common\target\surefire\surefire7173755579242669422tmp C:\Developmentapp\common\target\surefire\surefire_02286083488797420807tmp"
[ERROR] -> [Help 1]

 

I have tried multiple versions of the surefire plugin, from 2.18.1 all the way to 3.0.0-M3.

I looked at the logs via the help menu and see this exception, but it looks like a UI issue not directly related to my running the test:

 

2019-06-05 14:24:11,435 [6475483] ERROR - #com.intellij.ui.AppIcon - IntelliJ IDEA 2018.3.1 Build #IU-183.4588.61
2019-06-05 14:24:11,435 [6475483] ERROR - #com.intellij.ui.AppIcon - JDK: 1.8.0_152-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o
2019-06-05 14:24:11,435 [6475483] ERROR - #com.intellij.ui.AppIcon - OS: Windows 10
2019-06-05 14:24:11,435 [6475483] ERROR - #com.intellij.ui.AppIcon - Could not initialize class com.intellij.ui.Win7TaskBar
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.ui.Win7TaskBar
at com.intellij.ui.AppIcon$Win7AppIcon._setTextBadge(AppIcon.java:575)
at com.intellij.ui.AppIcon$BaseIcon$1.applicationActivated(AppIcon.java:155)
at sun.reflect.GeneratedMethodAccessor614.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:397)
at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:358)
at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:347)
at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:324)
at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:29)
at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:196)
at com.sun.proxy.$Proxy116.applicationActivated(Unknown Source)
at com.intellij.ide.ApplicationActivationStateManager.setActive(ApplicationActivationStateManager.java:122)
at com.intellij.ide.ApplicationActivationStateManager.updateState(ApplicationActivationStateManager.java:69)
at com.intellij.ide.IdeEventQueue.processAppActivationEvents(IdeEventQueue.java:685)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:557)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.SequencedEvent.dispatch(SequencedEvent.java:128)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:668)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

0

Could be some antivirus issue, it may kill your JVM and prevent IDE from loading some libraries.

0

Please sign in to leave a comment.