notReallyDev
notReallyDev

Reputation: 179

Kotlin Test suite: An annotation argument must be a compile-time constant

I created a test suite class that I created to run my Espresso instrumented tests. For some reason, when I try to run it, the build fails with a load of build errors, including "Unresolved reference" for each of the modules and tests, and "An annotation argument must be a compile-time constant". Is it an issue with the tests living in different directories?

package org.x.android.group_1

import org.x.android.group_1.module_x.TestA
import org.x.android.group_1.module_x.TestB
import org.x.android.group_1.module_y.TestC
import org.x.android.group_1.module_y.TestD
import org.junit.runner.RunWith
import org.junit.runners.Suite

@RunWith(Suite::class)
@Suite.SuiteClasses(
        TestA::class,
        TestB::class,
        TestC::class,
        TestD::class
)
class TestSuiteGroup1

edit: the tests I'm passing in are written in Java, could that be an issue?

Upvotes: 1

Views: 690

Answers (1)

petestmart
petestmart

Reputation: 382

I know this was posted a while ago, but I came across this same issue.

Turned out that I needed to put my tests in the

androidTest/java/com/example/appname folder instead of the test/java/com/example/appname folder

Once I moved everything it worked great!

Upvotes: 1

Related Questions