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.

Fork in test should handle exceptions during creation of test class

See original GitHub issue

We recently ran into a pretty severe issue where a ScalaTest test class was throwing a NPE during construction, which caused test execution to stop but for success to be reported. This meant that we were running 1/3 of our test suite instead of the full test suite and failures were not reported. Note that this was a multi-module build.

I can provide a simple test case if that helps.

The output was:

Exception in thread "Thread-32" java.io.EOFException
    at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2571)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1315)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
    at sbt.React.react(ForkTests.scala:98)
    at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.run(ForkTests.scala:66)
    at java.lang.Thread.run(Thread.java:722)
Exception in thread "Thread-32" java.io.EOFException
    at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2571)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1315)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
    at sbt.React.react(ForkTests.scala:98)
    at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.run(ForkTests.scala:66)
    at java.lang.Thread.run(Thread.java:722)
[info] Passed: : Total 0, Failed 0, Errors 0, Passed 0, Skipped 0

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:29 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelahlerscommented, Feb 26, 2019

Seeing this with increasing regularity, typically in CID.

1reaction
kapilsainicommented, May 12, 2015

I am still facing issue when using fork in Test := true

Can some one please suggest the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception handling in test class. How to write the test class for ...
Exception class, you can construct most (if not all) of the more specific exception classes (like System.DmlException ). Your output here is ...
Read more >
Handling exceptions in tests: Junit & Kotest - Kotlin Testing
Exceptions are crucial part of some Java APIs. How to assert that exceptions was thrown? In this note you will examples of various...
Read more >
Maven Surefire Plugin – Fork Options and Parallel Test ...
The surefire offers a variety of options to execute tests in parallel, allowing you to make best use of the hardware at your...
Read more >
Built-in Exceptions — Python 3.11.1 documentation
In Python, all exceptions must be instances of a class that derives from ... This can be used to test an exception handler...
Read more >
All you need to know about Data-Driven Testing - Testsigma
Data-driven or parameterized testing is a way to automate the creation, use, ... and impossible to manage when you have to run through...
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