Skip to content

templating

Template generator for TestSuite from system requirements.

generate_suite_str(requirements)

Generate a TestSuite template string from a list of requirements.

Parameters:

Name Type Description Default
requirements list[QASDescriptor]

List of system requirements to make into TestCases

required

Returns:

Type Description
str

TestSuite template string that can be used to instantiate a TestSuite

Source code in mlte/suite/templating.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def generate_suite_str(requirements: list[QASDescriptor]) -> str:
    """
    Generate a TestSuite template string from a list of requirements.

    :param requirements: List of system requirements to make into TestCases
    :return: TestSuite template string that can be used to instantiate a TestSuite
    """
    suite = TestSuite()
    for requirement in requirements:
        suite.add_test_case(
            TestCase(
                identifier=str(requirements.index(requirement) + 1),
                goal="",
                quality_scenarios=[
                    requirement.identifier if requirement.identifier else ""
                ],
            )
        )

    return suite.to_template_str()