Clarification on "inheritance" of test suits and dependencies

I’m writing convention plugins and I have questions with regards to how test dependencies transfer to dependent plugins.

My base plugin defines

dependencies {
	testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
	testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitPlatformVersion")
}

My server plugin defines

plugins {
	id("com.my.base") // the above plugin
	id("war")
	id("jvm-test-suite")
}

testing {
	suites {
		configureEach {
			useJUnitJupiter()
			dependencies {
				// automatic for 'test', but not for the others
				implementation(project())
				
				// these are needed despite being declared as dependencies in the parent plugin
				implementation("org.junit.jupiter:junit-jupiter:$junitVersion")
				runtimeOnly("org.junit.platform:junit-platform-launcher:$junitPlatformVersion")
			}
		}

		test {
			dependencies {
				implementation("org.jboss.weld:weld-junit5:$weldJunitVersion")
			}
		}

		integrationTest(JvmTestSuite) {
			dependencies {
				implementation("org.jboss.arquillian.junit5:arquillian-junit5-container:$arquillianVersion")
			}
		}
	}
}

As commented, the test dependencies are not “inherited” by the test suits, at least that’s what I found out. My questions:

  1. Is this correct behavior? I need to choose either test suites or test dependencies?
  2. I want all the tests in projects that apply the base plugin to have the jupiter dependencies. How can I specify them once in that plugin and have the applying projects “inherit” them?
  3. If in the base plugin I define test suits, and then in applying projects (server) I also define test suits, what are the rules for “inheritance” and overriding? Are test suites overriden separately (test overrides test, intergrationTest overrides integrationTest)? Combined? Is the whole testing block overriden?

I didn’t see this covered in The JVM Test Suite Plugin, but maybe I don’t understand a more basic concept that should be obvious.

Is this correct behavior?

Yes

I need to choose either test suites or test dependencies?

No, but in your base plugin you only define dependencies for the test suite called test.
You do not define dependencies for integrationTestImplementation.
What you probably want to do in your base plugin is again a configureEach over all test suites, adding those dependencies to the respective configurations.

If in the base plugin I define test suits, and then in applying projects (server) I also define test suits, what are the rules for “inheritance” and overriding?

There is no “inheritance” as there is no extending".
If you try to declare a test suite with the same name, it will fail as it already exists.
But you can anytime further configure the test suite just like you further configure the test test suite that the built-in plugins added for you.

Are test suites overriden separately (test overrides test, intergrationTest overrides integrationTest)? Combined? Is the whole testing block overriden?

Nothing is overridden, see above.


Btw. I strongly recommend switching to Kotlin DSL. By now it is the default DSL, you immediately get type-safe build scripts, actually helpful error messages if you mess up the syntax, and amazingly better IDE support if you use a good IDE like IntelliJ IDEA or Android Studio.