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

BehaviorSpec Then assertion shows green in Intellij but should show red #1857

Closed
HoffiMuc opened this issue Nov 22, 2020 · 3 comments · Fixed by #1934
Closed

BehaviorSpec Then assertion shows green in Intellij but should show red #1857

HoffiMuc opened this issue Nov 22, 2020 · 3 comments · Fixed by #1934
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Milestone

Comments

@HoffiMuc
Copy link

HoffiMuc commented Nov 22, 2020

I am using kotlin 1.4.10 ; micronaut-bom:2.1.3 ; micronaut-test-kotest:2.2.1 and kotest-runner-junit5-jvm:4.2.5

running this most simple BehaviorSpec:

@MicronautTest
class DummySpec(
) : BehaviorSpec({

    Given("dummy test") {
        When("dummy test is executed") {
            Then("dummy test just should fail") {
                1 shouldBe 2
                "x" shouldBe "y"
            }
        }
    }
})

EDIT:
I updated to kotlin 1.4.20 and micronaut
even though the overall Test fails, in Intellij (with kotest plugin 1.1.20-IC-2020.2)

the Then part shows green (see screenshot)

Screenshot

I have the following ProjectConfig:

package io.micronaut.test.kotest

import io.kotest.core.config.AbstractProjectConfig
import io.kotest.core.spec.IsolationMode
import io.micronaut.test.extensions.kotest.MicronautKotestExtension

object ProjectConfig : AbstractProjectConfig() {
    override val isolationMode = IsolationMode.SingleInstance
    override val globalAssertSoftly = true

    override fun listeners() = listOf(MicronautKotestExtension)
    override fun extensions() = listOf(MicronautKotestExtension)

    override fun beforeAll() {
        println("ProjectConfig beforeAll Tests:")
        println(String.format("    isolationMode = %s\n    globalAssertSoftly = %b", isolationMode.name, globalAssertSoftly))
    }

    override fun afterAll() {
        println("ProjectConfig afterAll Tests:")
        println(String.format("    isolationMode = %s\n    globalAssertSoftly = %b", isolationMode.name, globalAssertSoftly))
    }
}

is this a bug, or am I missing something here?

EDIT: I updated to kotlin 1.4.20 and micronaut 2.2.0 ... still the same

@LeoColman LeoColman added bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework. labels Nov 25, 2020
@sksamuel
Copy link
Member

I get this:

image

Can you try that dummy test but removing the @MicronautTest annotation ?
Just to see where the error might be.

@HoffiMuc
Copy link
Author

HoffiMuc commented Dec 18, 2020

same result without @io.micronaut.test.extensions.kotest.annotation.MicronautTest again.

Given failed, but When and Then are still green!

(did this using most recent IntelliJ kotlin and kotest plugin)

Do you also have the ProjectConfig set to:

object ProjectConfig : AbstractProjectConfig() {
    override val isolationMode = IsolationMode.SingleInstance
    override val globalAssertSoftly = true

??

@sksamuel
Copy link
Member

I get a similar error with global assert softly.

image

So is probably related to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants