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.

Error "java.lang.AssertionError: Unexpected start event()" from Courgette on build command

See original GitHub issue

Hi Prashant, When I run my tests every tests runs and finishes with results logged in the courgette index.html report - ie if i have 20 test running with 3 threads, all run and finish with appropriate outcomes and results. However, the build always terminates with an error coming from the Courgette runner itself

xml output form dir -> build/test-results/test/TEST-.xml

<?xml version="1.0" encoding="UTF-8"?> <testsuite name="" tests="1" skipped="0" failures="1" errors="0" timestamp="2020-02-28T05:01:11" hostname="XXXXXXX" time="0.0"> <properties/> <testcase name="" classname="" time="0.0"> <failure message="java.lang.AssertionError: Unexpected start event for ()" type="java.lang.AssertionError">java.lang.AssertionError: Unexpected start event for () at org.gradle.api.internal.tasks.testing.junit.JUnitTestEventAdapter.testStarted(JUnitTestEventAdapter.java:58) at org.junit.runner.notification.SynchronizedRunListener.testStarted(SynchronizedRunListener.java:80) at org.junit.runner.notification.RunNotifier$5.notifyListener(RunNotifier.java:156) at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72) at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:153) at java.util.HashMap$Values.forEach(HashMap.java:981) at courgette.runtime.junit.CourgetteJUnitRunner.notifyTestStarted(CourgetteJUnitRunner.java:70) at courgette.api.junit.Courgette.run(Courgette.java:67) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38) at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157) at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:748) </failure> </testcase> <system-out><![CDATA[]]></system-out> <system-err><![CDATA[]]></system-err> </testsuite>

Output from console/terminal: `Unexpected start event for () java.lang.AssertionError: Unexpected start event for () at org.gradle.api.internal.tasks.testing.junit.JUnitTestEventAdapter.testStarted(JUnitTestEventAdapter.java:58) at org.junit.runner.notification.SynchronizedRunListener.testStarted(SynchronizedRunListener.java:80) at org.junit.runner.notification.RunNotifier$5.notifyListener(RunNotifier.java:156) at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72) at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:153) at java.util.HashMap$Values.forEach(HashMap.java:981) at courgette.runtime.junit.CourgetteJUnitRunner.notifyTestStarted(CourgetteJUnitRunner.java:70) at courgette.api.junit.Courgette.run(Courgette.java:67) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38) at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175) at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157) at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:748)

com.diff.CourgetteTestRunner > . FAILED java.lang.AssertionError 1 test completed, 1 failed

Task :courgetteTestRunner FAILED FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:courgetteTestRunner’.

There were failing tests. See the report at: file://XXXXXXXXXXXXXXX

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Get more help at https://help.gradle.org BUILD FAILED in 6m 24s`

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
prashant-ramcharancommented, Feb 28, 2020

I cannot seem to reproduce this error @bill2605

Courgette includes JUnit 4.12 so can you try removing JUnit 4.13 dep from your build.gradle and let me know if you get the same result?

1reaction
prashant-ramcharancommented, Feb 28, 2020

Thanks for that. I’ll investigate further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gradle ignoring failing tests in a StringSpec · Issue #336 - GitHub
lang.AssertionError: Unexpected start event for [engine:kotlintest]/[spec:StringSpecTest] and the tests are marked as ignored instead of failed.
Read more >
java - AssertionError Unexpected method call when unit testing
When I run the test i get the error: java.lang.AssertionError: Unexpected method call TestdesignServiceImpl.saveTestdesign(com.example.
Read more >
Unit Test Complete Job is failing - Camunda Forum
Environment : Java 17 Spring Boot, Junit5 Error in console: java.lang.AssertionError: Expected element with id task1 to be passed 1 times, ...
Read more >
Running JUnit ActiveTestSuite - Help/Discuss - Gradle Forums
Gradle reports what appears to be JUnit lifecycle errors: java.lang.AssertionError: Unexpected start event for ...
Read more >
Assertions In Selenium Using Junit And TestNG Frameworks
Hard assertions usually throw an Assertion Error whenever an assertion condition has not been met. The test case will be immediately marked ...
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