Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
santiagopagani opened this issue Jun 7, 2022 · 2 comments

Comments

@santiagopagani
Copy link

santiagopagani commented Jun 7, 2022

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.

@cuinixam
Copy link

cuinixam commented Nov 4, 2023

Hi, I also find the idea of a global configuration very useful. Currently, to link test cases with test results, we have to add :results: [[tr_link('title', 'case')]] to all the GTest test cases.
I would be willing to implement this feature if this discussion leads to something concrete.

@cuinixam
Copy link

cuinixam commented Nov 4, 2023

I have just realised that the needs_global_options actually exists 😮 Sorry!
As for linking multiple tests results to test cases, hopefully #68 will get through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants