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

Nested tests error in failed tests number #1484

Closed
razvn opened this issue Jun 2, 2020 · 2 comments
Closed

Nested tests error in failed tests number #1484

razvn opened this issue Jun 2, 2020 · 2 comments

Comments

@razvn
Copy link

razvn commented Jun 2, 2020

in 4.0.6

In a nested test:

class FeatureSpecTest : FeatureSpec({
    feature("A") {
        scenario("a-1") {
            true shouldBe true
        }
        scenario("a-2") {
            true shouldBe true
        }
        scenario("a-3") {
            true shouldBe false
        }
    }
})

if one fails, gradle reports 3 failed tests:

FeatureSpecTest > Feature: A > FeatureSpecTest.Scenario: a-3 FAILED
    org.opentest4j.AssertionFailedError at FeatureSpecTest.kt:13
FeatureSpecTest > Feature: A FAILED
    org.opentest4j.AssertionFailedError at FeatureSpecTest.kt:13
FeatureSpecTest > executionError FAILED
    org.opentest4j.AssertionFailedError at FeatureSpecTest.kt:13
5 tests completed, 3 failed
> Task :test FAILED

Also the number of tests are not accurate should be 3 not 5.

same code in Junit

class JunitTest {

    @Nested
    inner class A {
        @Test
        fun `a-1`() {
            assertTrue(true)
        }
        @Test
        fun `a-2`() {
            assertTrue(true)
        }
        @Test
        fun `a-3`() {
            assertTrue(false)
        }
    }
}

reports the right amount of tests and faild ones:

JunitTest > A > a-3() FAILED
    org.opentest4j.AssertionFailedError at JunitTest.kt:21
3 tests completed, 1 failed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
@sksamuel
Copy link
Member

sksamuel commented Jun 3, 2020

Same issue as #1483. Gradle limitation.

@sksamuel sksamuel closed this as completed Jun 3, 2020
@razvn
Copy link
Author

razvn commented Jun 7, 2020

Anything that @melix can do about those limitations ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants