Add boilerplates for test_suite module type to tradefed_modules
This CL adds a new module type: test_suite.
test_suite {
name: "example-test-suite",
description: "some example test suite"
tests: [
"ExampleTest1",
"ExampleTest2",
],
}
test_suite allows users to define a suite of tests that can be run together. The test_suite module type takes a list of tests as input, and it will generate a single test module that can be run by tradefed.
This CL also adds a test for the test_suite module type. The test verifies that the test_suite module type can be used to define a suite of tests, and that the generated test module can be run by tradefed.
Change-Id: I1a8585899b29b0e96234a7abbd367de033d5f686
Bug: 372945132
diff --git a/tradefed_modules/test_suite_test.go b/tradefed_modules/test_suite_test.go
new file mode 100644
index 0000000..f9e9da0
--- /dev/null
+++ b/tradefed_modules/test_suite_test.go
@@ -0,0 +1,47 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package tradefed_modules
+
+import (
+ "android/soong/android"
+ "android/soong/java"
+ "testing"
+)
+
+func TestTestSuites(t *testing.T) {
+ t.Parallel()
+ android.GroupFixturePreparers(
+ java.PrepareForTestWithJavaDefaultModules,
+ android.FixtureRegisterWithContext(RegisterTestSuiteBuildComponents),
+ ).RunTestWithBp(t, `
+ android_test {
+ name: "TestModule1",
+ sdk_version: "current",
+ }
+
+ android_test {
+ name: "TestModule2",
+ sdk_version: "current",
+ }
+
+ test_suite {
+ name: "my-suite",
+ description: "a test suite",
+ tests: [
+ "TestModule1",
+ "TestModule2",
+ ]
+ }
+ `)
+}