SAP / quality-continuous-traceability-monitor

Link your product's requirements with automated tests and their test results
Apache License 2.0
6 stars 7 forks source link

Traceability task does not works for Junit Tests which has a Nested Java Structure #16

Open Dhanraj29693 opened 5 years ago

Dhanraj29693 commented 5 years ago

Dear Colleagues,

Follow up issue to 2291.

Currently i am trying a POC of integrating Traceability task in our pipeline for Junit Tests. As of now Traceability task works only for Junit tests if it has normal java class structure. If there is a nested java class structure in our junit test then Traceability task is not able to map the jira id's to the test class which is maintained in the "requirement_mapping.json" file.

Approach followed Traceability Task: using requirement_mapping.json file [i.e., if "mapping" element is used in the "config_traceability.json" file]

Final Traceability report

Jenkins - Traceability task Console

Traceability code - config_traceability.json Link

Traceability code - requirement_mapping.json

Nested Java Code

Thanks for your help in advance!!!

Regards, Dhanraj

doergn commented 5 years ago

Hi Dhanraj,

the name of the test class/method in the mapping.json must match the name of the test in the surefire xml test result. Otherwise CTM won't find/match it. The class in your mapping file is named: com.sap.c4p.rm.resourcerequest.handlers.test.AdditionThreeTest the test is com.sap.c4p.rm.resourcerequest.handlers.test.AdditionThreeTest$WhenThreeNumbers.testAdditionOfTwoIntegers() (at least I guess that's what is shown in the test result XML...I couldn't find it in your Jenkins job (most likely due to access right problems))

Another thing: You do not need to annotate/comment your tests in the sourcecode if you're using a mapping file. It's an OR (either use the mapping file OR use comments in your sourcecode)

Hope this helps

Dirk

Dhanraj29693 commented 5 years ago

Hello Dirk,

I even tried by changing the class name in mapping file as "com.sap.c4p.rm.resourcerequest.handlers.test.AdditionThreeTest$WhenThreeNumbers.testAdditionOfTwoIntegers()" which is there in test file but still it did not work.

Regards, Dhanraj

doergn commented 5 years ago

Can you send me your surefire test report XML?