Skip to content

How to configure the tr_link dynamic function to match a classname and a casename #35

@santiagopagani

Description

@santiagopagani

Hi,

I would like to know if test_reports currently supports our use case.
Namely, we have multiple software requirements, where each requirement usually matches a method of a class.
For example, let's say, we have ClassA with methods get() and set(), and we then have ReqA_get, and ReqA_set.

For testing we use GTest, and we normally have a test file with a test class that tests an entire class.
For example, we would have GTest class TestClassA for testing ClassA.
The test involves multiple test functions, where multiple test functions are involved in testing a method of ClassA.
For example, we would have TestClassA_get_1, and TestClassA_get_2 for test method get() of ClassA, and we would have TestClassA_set_1, TestClassA_set_2, and TestClassA_set_3 for testing method set() of ClassA.
We then define the Test Specification in such a way that we have one specification per test.

The xml output from GTest for the test cases would be (summarizing only the class name and case name):
classname="TestClassA" and name="get_1"
classname="TestClassA" and name="get_2"
classname="TestClassA" and name="set_1"
classname="TestClassA" and name="set_2"
classname="TestClassA" and name="set_3"

So far, by having a configuration as for example

needs_global_options = {
    'tests': "[[tr_link('classname', 'title')]]",
}

we need to have the same name as the test class in all test specifications, e.g., .. test:: TestClassA, and we would get ALL test cases in the test file TestClassA linked to every test specification. However, we would like to have each test case only linked with its corresponding test specification.

One way to do this would be to adapt the tr_link function such that it could take a tupple of multiple things that need to be matched. We could then add classname and casename to the test specification and then have both things matched to the xml.

Thank you for the great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions