We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am new to Kotlin and Spek. I am trying to setup Spek with kotlin-android for BDD Testing. I have added the following in the build.gradle:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
// Repository required for Unit Testing repositories { maven { url "http://dl.bintray.com/jetbrains/spek" } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
// Unit Test Specific dependencies testCompile 'org.jetbrains.spek:spek-api:1.1.0-beta3' testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.1.0-beta3' testCompile 'org.junit.platform:junit-platform-runner:1.0.1' testCompile 'org.mockito:mockito-core:2.7.5' testCompile "com.nhaarman:mockito-kotlin:1.3.0" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
I have added the following example test:
import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on
import kotlin.test.assertEquals
class ExampleUnitTest : Spek( { given("Two numbers") { val firstNumber = 3 val secondNumber = 5 on("adding the numbers") { val result = firstNumber + secondNumber it("should return the correct sum") { assertEquals(8, result) } } }
})
On building the project, I'm getting a Plugin Error, Spek threw an uncaught TypeCastException, which only gives option of disabling the Plugin.
Can anyone please help in setting up the Spek tool for Android with Kotlin? Thanks a lot in advance!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am new to Kotlin and Spek. I am trying to setup Spek with kotlin-android for BDD Testing.
I have added the following in the build.gradle:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
// Repository required for Unit Testing
repositories {
maven { url "http://dl.bintray.com/jetbrains/spek" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
I have added the following example test:
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on
import kotlin.test.assertEquals
class ExampleUnitTest : Spek( {
given("Two numbers") {
val firstNumber = 3
val secondNumber = 5
on("adding the numbers") {
val result = firstNumber + secondNumber
it("should return the correct sum") {
assertEquals(8, result)
}
}
}
})
On building the project, I'm getting a Plugin Error, Spek threw an uncaught TypeCastException, which only gives option of disabling the Plugin.
Can anyone please help in setting up the Spek tool for Android with Kotlin?
Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: