raniejade / spek-idea-plugin

MIT License
48 stars 15 forks source link

Plugin doesn't work with data-driven-extension #46

Closed sakuna63 closed 6 years ago

sakuna63 commented 7 years ago

spek data-driven-extension work well on command line execution. but on IDE with Spek plugin, it looks to not execute each test-case defined by org.jetbrains.spek.data_driven.on.

environment

IDE: AndroidStudio 2.3.3
Kotlin version: 1.1.3
Spek version: 1.1.2
Plugin version: 0.3.5

test code

import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.data_driven.Data1
import org.jetbrains.spek.data_driven.data
import org.jetbrains.spek.data_driven.on
import org.junit.platform.runner.JUnitPlatform
import org.junit.runner.RunWith
import kotlin.test.assertEquals

@RunWith(JUnitPlatform::class)
object StringExtensionTest : Spek({
    val data = arrayOf<Data1<String?, Boolean>>(
        data("0", true),
        data("-1", true),
        data("-", false),
        data(null, false),
        data("", false),
        data("1a", false),
        data("a1", false),
        data("1a1", false),
        data("-1-", false)
    )

    on("isInteger \"%s\"", with = *data) { input, expected ->
        it("should be $expected") {
            assertEquals(expected, input.isInteger())
        }
    }
})
raniejade commented 7 years ago

A few things to try out: change \"%s\" to '%s' or change should be $expected to ($input) should be $expected. Let me know if it works.

sakuna63 commented 6 years ago

Sorry, I hadn't read below notice in user guide.

If you’re using the JUnit 4 runner, the plugin won’t work as expected due to the bundled JUnit plugin taking over. http://spekframework.org/docs/latest/#ide-support

I guess this issues occurs due to junit4 plugin. so I close this.