Reputation: 3229
Running an instrumentation or unit test in the terminal with Gradle is relatively straightforward. Let's take this example class:
class MyClass {
@Test
fun mySimpleTest() {
// Test logic here
}
}
To run this single unit test method in the terminal (ignoring the fact that I could use wildcards and such):
./gradlew a:b:c:test --tests 'com.sample.package.MyClass.mySimpleTest'
But what if you have a Kotlin method that utilizes backticking?
class MyClass {
@Test
fun `my simple test`() {
// Test logic here
}
}
I tried replacing the spaces with underscores, removing spaces altogether, with and without backticks, etc and haven't had any success.
So my question is this: How do you run a single test method in the terminal when the method name utilizes backticks?
Upvotes: 7
Views: 782
Reputation: 271820
You don't need to do anything special. Keep the spaces in there:
./gradlew a:b:c:test --tests 'com.sample.package.MyClass.my simple test'
The JVM allows method names with spaces in them. It's just that the Java language doesn't. Kotlin doesn't need to, and doesn't actually change the name of the methods to something else (unless you ask it to with @JvmName
of course).
Upvotes: 6