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

Plugin Error : Spek threw an uncaught TypeCastException. #280

Closed
ManaliN opened this issue Oct 11, 2017 · 0 comments
Closed

Plugin Error : Spek threw an uncaught TypeCastException. #280

ManaliN opened this issue Oct 11, 2017 · 0 comments

Comments

@ManaliN
Copy link

ManaliN commented Oct 11, 2017

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!

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