question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Retrocess with version >3.15 JUnit 4 Runner

See original GitHub issue

Clone this repository.

It’s an Android Project what tries to use KotlinTest JUnit4 Runner. There’s a single test in this repository, called ExampleUnitTest. It’s a simply assertion that 4 is 2+2.

When trying to execute this test using KotlinTest version 3.1.5, it works correctly, using the following dependency:

testImplementation “io.kotlintest:kotlintest-runner-junit4:3.1.5”

However, if this version is promoted to anything above it, for instance:

testImplementation “io.kotlintest:kotlintest-runner-junit4:3.1.6”

Note that this happen with any version above 3.1.5, including the latest 3.1.8.

The test fails with this exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/launcher/TestExecutionListener
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:39)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:45)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.launcher.TestExecutionListener
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 16 more

Process finished with exit code 1

It seems to be a sometimes-happen issue, and sometimes I’ll get a green test. Most of the times I’ll get the above exception

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:24 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
LeoColmancommented, Jul 30, 2018

This is hapenning with Intellij 2018.1 and 2018.2

0reactions
LeoColmancommented, Sep 12, 2018

For now, I couldn’t reproduce this specific scenario anymore.

If I come through this again, I’ll open a new ticket.

I’ll close this one for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

About - JUnit 5
... Version: 4.13.2. JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing...
Read more >
Unit Testing with JUnit 4 - Tutorial - Vogella.com
This tutorial explains unit testing with JUnit 4.x. It explains the creation of JUnit tests and the usage of the Eclipse IDE for...
Read more >
No tests found with test runner 'JUnit 4' - java - Stack Overflow
this just happened to me. Rebuilding or restarting Eclipse didn't help. I solved it by renaming one of the test methods to start...
Read more >
Custom JUnit 4 Test Runners - Baeldung
In this quick article, we're going to focus on how to run JUnit tests using custom test runners. Simply put, in order to...
Read more >
AndroidJUnitRunner - Android Developers
... is a JUnit test runner that lets you run instrumented JUnit 4 tests on Android ... When using AndroidJUnitRunner version 1.0 or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found