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.

afterTest in BehaviorSpec test runs after each Given, When and Then

See original GitHub issue

I use BehaviorSpec and wanted to add some cleanup to be run after each individual test (Given {} block). However, it looks like afterTest is called after each Given, When and Then block (in reverse order). Is this intentional?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jadenjackcommented, Nov 29, 2022

With kotest v5.5.4

if (testCase.isRootTest()) {

}
1reaction
dannylagrouwcommented, Feb 5, 2020

Yes, I consider a test to be a complete block of Given { When { Then {} } }, so I would expect afterTest to run after each instance of that has run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Kotest | Baeldung on Kotlin
In this tutorial, we'll focus on running the tests only on the JVM ... BDD like tests in this style using given, when...
Read more >
kotlin kotest/kotlintest BehaviorSpec afterSpec/finalizeSpec ...
I want to execute a cleanup after the whole Spec (respectively every Given clause) has finished. @MicronautTest class StructurePersistSpec( ...
Read more >
TestNG @AfterTest Annotation - Javatpoint
The @AfterTest annotated method run after the execution of all the test methods present in the classes which are kept inside the folder....
Read more >
Testing Styles - Kotest
The following table contains the test styles you can pick from along with ... tests in the BDD style, BehaviorSpec allows you to...
Read more >
Kotest - Kotlinlang
Looking at kotest after ThoughtWorks Radar … why don t use the minus keyword ... Test 2 afterTest beforeTest single 1 afterTest afterEach...
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