Skip to content

Commit

Permalink
Add test case for pairwise test matrix generation
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Feb 20, 2024
1 parent 448ce6f commit 19caa12
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tcms/testruns/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,44 @@ def test_generate_full_matrix_with_1_dimensional_property(self):
self.assertIn(["platform=mac"], matrix)
self.assertIn(["platform=windows"], matrix)

def test_generate_pairwise_matrix_with_3_dimensional_properties(self):
test_run = TestRunFactory()
test_case = TestCaseFactory(summary="Installation on RAID array")

# properties assigned to the test case
for raid_level in [0, 1, 4, 5, 6, 10, "linear"]:
TestCaseProperty.objects.get_or_create(
case=test_case, name="Raid Level", value=raid_level
)
for encryption in ["Yes", "No"]:
TestCaseProperty.objects.get_or_create(
case=test_case, name="Encryption", value=encryption
)
for mount_point in ["/", "/home"]:
TestCaseProperty.objects.get_or_create(
case=test_case, name="Mount Point", value=mount_point
)

# properties assigned to TestRun (aka environment)
for cpu_arch in ["aarch64", "x86_64", "ppc64le"]:
TestRunProperty.objects.get_or_create(
run=test_run, name="CPU Arch", value=cpu_arch
)
for fedora_variant in ["Server", "Workstation"]:
TestRunProperty.objects.get_or_create(
run=test_run, name="Fedora Variant", value=fedora_variant
)

properties = test_run.property_set.union(
TestCaseProperty.objects.filter(case=test_case)
)
matrix = self.deconstruct_matrix(
test_run.property_matrix(properties, "pairwise")
)
# the 2 biggest dimensions control the max size of a pairwise matrix
# in this case: CPU Arch * RAID Level == 3 * 7
self.assertEqual(len(matrix), 21)


class TestExecutionActualDuration(TestCase):
@parameterized.expand(
Expand Down

0 comments on commit 19caa12

Please sign in to comment.