Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clues to be added to timeouts #2230

Closed
Tracked by #2226
sschuberth opened this issue Apr 30, 2021 · 9 comments
Closed
Tracked by #2226

Allow clues to be added to timeouts #2230

sschuberth opened this issue Apr 30, 2021 · 9 comments
Labels
assertions 🔍 Related to the assertion mechanisms within the testing framework. enhancement ✨ Suggestions for adding new features or improving existing ones. framework 🏗️ Pertains to the core structure and components of the Kotest framework. pinned 📌 Issues of high importance or that need to remain visible.
Milestone

Comments

@sschuberth
Copy link
Member

It would be nice if there was a way to also give a clue when a timeout occurs (configured either via withTimeout() or the test configuration). A use-case would be tests that call external programs. Such programs might run interactive prompts, blocking the test, which then runs into a timeout. In such cases stdout could be shown as a clue, which would help to identify the interactive prompt.

@sschuberth sschuberth added the enhancement ✨ Suggestions for adding new features or improving existing ones. label Apr 30, 2021
@sksamuel sksamuel added this to the 5.0 milestone May 19, 2021
@LeoColman LeoColman assigned LeoColman and unassigned LeoColman May 23, 2021
@sksamuel sksamuel added assertions 🔍 Related to the assertion mechanisms within the testing framework. framework 🏗️ Pertains to the core structure and components of the Kotest framework. labels Jul 12, 2021
@sksamuel sksamuel mentioned this issue Jul 12, 2021
71 tasks
@stale
Copy link

stale bot commented Sep 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 10, 2021
@sschuberth
Copy link
Member Author

This has just recently been referred to, so I believe it should stay open.

@stale stale bot removed the wontfix label Sep 10, 2021
@sksamuel sksamuel added the pinned 📌 Issues of high importance or that need to remain visible. label Sep 10, 2021
@sksamuel
Copy link
Member

It's in the roadmap. I've marked it as pinned.

@sksamuel
Copy link
Member

How do you see this working?
If I have a test that I set a timeout for 10 seconds and it times out - it will throw a timeout exception so you know why it failed. What extra information would you like in there ?

@sschuberth
Copy link
Member Author

What extra information would you like in there ?

See above (at the example of a CLI program that causes a timeout due to waiting for stdin): "In such cases stdout could be shown as a clue, which would help to identify the interactive prompt."

@sksamuel
Copy link
Member

Right, so this is specific to stdin in timeouts.
Kotest would have to capture stdout in case the test times out.

I wonder if another construct makes sense.

withStdOutClue { }

Which captures std out and emits it as a clue if the test fails.

@sschuberth
Copy link
Member Author

I wasn't meaning to suggest such a specific change to be done to Kotest. But as some one who writes test with Kotest, I'd like to be able to "manually" pass any clue that I see fit to withTimeout(). At the time I filed this issue, I could not see a way to do that (e.g. by nesting withTimeout() inside withClue()).

@sksamuel
Copy link
Member

ohhh I see.

Right, that sounds like a really good idea.

@sksamuel sksamuel changed the title Combine withClue() and withTimeout() to get clues on timeouts Allow clues to be added to timeouts Sep 10, 2021
@sksamuel
Copy link
Member

sksamuel commented Sep 19, 2021

You can now next withTimeout inside a withClue,

  withClue("timey timey") {
     withTimeout(2) {
        delay(1000)
     }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assertions 🔍 Related to the assertion mechanisms within the testing framework. enhancement ✨ Suggestions for adding new features or improving existing ones. framework 🏗️ Pertains to the core structure and components of the Kotest framework. pinned 📌 Issues of high importance or that need to remain visible.
Projects
None yet
Development

No branches or pull requests

3 participants