Add items from a test case to a testrun report
I am using the "Test Detail Grouped by Test Case" report as my base. what I would like to do is add fields from the test case to each test run table. Say I have a text field, we'll call it "Field_A" in my test case. When I generate the summary for each testrun, which does not include "Field_A", though the test case does, I would like to include it in the report. I can get the ID of the test case. Can I use that to get the data in "Field_A"? I hope this makes sense!
Comments
-
I would also like to know how to do this!
0 -
is "Field_A" a custom field? If you know the ID of that specific field, you could use the following:
#set( $fa = $tr.getTestCase().getCustomField(fieldID).getTextValue())
$tr is the respective Test Run document.
and then use the variable $fa in your report accordingly.
if you don't know the field ID, this is a way to find it:
Create a report with the following inside:
#set( $fa = $tr.getTestCase().getCustomFields())
and let it print $fa. with that, you should get something like this (depends on the number of custom field your test case has):
[DocumentCustomFieldValue [document={id=testcase_id, name=testcase_name}, fieldId=this_is_what_you_need, id=any_number, organizationId=any_number, textValue=
Content of Field_A
]]
Patrick0 -
another, maybe easier possibility could be the following:
assuming the "unique field name" of your "Field_A" is "field_a".
#set( $tc = $tr.getTestCase())
#set( $fa = $velocityReportUtil.getValueForField($tc, "field_a", $dateFormat))
$dateFormat does not have to be set anywhere.
Then you can use $fa as you wish in your report
Patrick0