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

Test fixtures dependencies not possible in dependency block of test suite plugin #19066

Closed
toerni opened this issue Nov 19, 2021 · 8 comments
Closed
Labels
a:bug in:test-suites Work related to the JvmTestSuite Plugin

Comments

@toerni
Copy link

toerni commented Nov 19, 2021

While testing the new test-suite plugin, I tried to add a dependency to the test-fixtures of another project in the new dependency block using kotlin dsl

Expected Behavior

Expecting the dependency below to compile

testing {
    suites {

        val integrationtest by registering(JvmTestSuite::class) {
            this.useJUnitJupiter()


            dependencies {
                implementation(platform(testfixtures(":myProject")))
            }
            
            targets {
                all {
                    testTask.configure {
                        shouldRunAfter(tasks.named("test"))
                        testLogging {
                            events(FAILED, SKIPPED)
                            exceptionFormat = TestExceptionFormat.FULL
                        }
                    }
                }
            }
        }
    }
}

Current Behavior

testfixtures dependency does not compile in script plugin in buildSrc

Your Environment

  • gradle 7.3
  • jvm-test-suite plugin
@big-guy big-guy added in:test-suites Work related to the JvmTestSuite Plugin and removed to-triage labels Nov 19, 2021
@brizzbuzz
Copy link

any update on this? kind of a blocker for larger projects wanting to use the test suite API :(

@brizzbuzz
Copy link

Also kinda curious... beyond the need for being able to import external fixtures, it seems weird that even for the fixtures in the same module, this still doesn't work.

From the fixtures docs here

This will automatically create a testFixtures source set, in which you can write your test fixtures. Test fixtures are configured so that:
they can see the main source set classes
test sources can see the test fixtures classes

Shouldn't new test suites fall under the category of test sources?

@brizzbuzz
Copy link

A quick test seems to indicate that this is a viable work around, but it feels... wrong

testing {
  suites {
    val testIntegration by creating(JvmTestSuite::class) {
      useJUnitJupiter()
      dependencies {
        // Project
        implementation(project)
        implementation(project.dependencies.testFixtures(project))
        // ...

@Vampire
Copy link
Contributor

Vampire commented Jan 16, 2022

Actually it is probably the same issue as #19065 and the same work-arounds should apply, just that the other ticket is about platform and this about testFixtures. But in both cases the problem is, that the type is different in this dependencies block and that the extensions functions are only defined for the other type.

@SgtSilvio
Copy link

The same applies for annotationProcessor

@tresat
Copy link
Member

tresat commented Mar 8, 2022

I'm closing this issue, as it is covered by: #19472

@tresat tresat closed this as completed Mar 8, 2022
@SgtSilvio
Copy link

@tresat what about annotationProcessor dependencies, should I create a new issue for that?

@tresat
Copy link
Member

tresat commented Mar 12, 2022

No need, see: #20115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:test-suites Work related to the JvmTestSuite Plugin
Projects
None yet
Development

No branches or pull requests

6 participants