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.

Test should fail if exitProcess/System.exit called, unless explicitly expected

See original GitHub issue

I have a few functions that I currently cannot fully test because they call exitProcess(returnCode). I’d like kotlintest to report a failure if exitProcess/System.exit is called (rather than just terminating the test), unless I’ve explicitly told it I’m expecting it to be called, with an optional way to check the return code.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
sksamuelcommented, Apr 2, 2018
0reactions
sksamuelcommented, Jan 25, 2019

SpecSystemExitListener is the wrong name, should be SystemExitSpecListener. I’ll have to deprecate it and add another at some point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test should fail if exitProcess/System.exit called, unless ...
I'd like kotlintest to report a failure if exitProcess/System.exit is called (rather than just terminating the test), unless I've explicitly ...
Read more >
Java: How to test methods that call System.exit()?
Try modifying the TestCase to run with a security manager that prevents calling System. exit, then catch the SecurityException.
Read more >
Testing System.exit() with JUnit5 - Todd Ginsberg
Writing a unit test that actually exits the JVM while it is under test is definitely not ideal. Whenever the JVM does something...
Read more >
Exception Handling — Python 3.11.1 documentation
Unless the error is a SystemExit , in that case no traceback is printed and the Python process will exit with the error...
Read more >
Best practices for writing unit tests - .NET - Microsoft Learn
When you have a suite of well-named unit tests, each test should be able to clearly explain the expected output for a given...
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