Showing Requirements verified by Test Case

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Showing Requirements verified by Test Case

Postby rmartelli@rheinmetall.ca » Tue May 05, 2020 7:17 am

I have built a verifies relationship between Test Cases and Requirements but when trying to follow the relationship all I am seeing are the associations. How can I retrieve the requirement verified by the test case? The code below correctly retrieves the test cases but does not seem able to identify 'verify' relationships.

#foreach($tc in $elements)
#if ($tc.elementType == "testcase")
$set ($tmp = $testCases.add($tc))
$tc.name : $tc.elementType
#set ($reqs = $report.getRelationship($tc, true))
#foreach($r in $reqs) $r.name #end
#end#end
rmartelli@rheinmetall.ca
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Wed Aug 14, 2019 7:24 am

Re: Showing Requirements verified by Test Case

Postby sarawut_w » Wed May 06, 2020 9:22 pm

Hello,

Please see this sample code:
Code: Select all
##Get all TestCase elements
#foreach($tc in $TestCase)
$tc.name
Verifies:
##Get verifies elements
#foreach($v in $tc.verifies)
- $v.name
#end
#end


Best regards,
Sarawut
sarawut_w
No Magic
No Magic
 
Posts: 405
Posts Rating:32
Joined: Thu Jun 23, 2011 12:47 am

Re: Showing Requirements verified by Test Case

Postby rmartelli@rheinmetall.ca » Thu May 07, 2020 5:30 am

That didn't work for me but I'm very interested in understanding the syntax. What document speaks to that syntax?

What I ended up doing was as follows:
#set($reqs = $array.createHashSet())
#set($testCases = $array.createHashSet())
#foreach($tc in $elements)
#if ($tc.elementType == “testcase”)
#set($tmp = $testCases.add($tc))
$tc.name : $tc.elementType
#end
#if ($tc.elementType == “functionalrequirement” || $tc.elementType == “interfacerequirement”)
#set($tmp = $reqs.add($tc))
$tc.name : $tc.elementType
#end
#end

The array $elements at the very beginning seems to contain all objects passed in but at some point in the report template (use case specification) seems to get filtered. Hence, at the beginning I pulled all the objects that I needed into their own arrays.
Using the use case specification template I added a section to match the test case (activity) name to the use case and extract the verified requirements.

#foreach($e in $testCases)
#if ($e.name == $u.name)
#foreach($r in $reqs)
#if($r.verifiedBy)
#set ($verifiedBy = $r.verifiedBy)
#foreach($from in $sorter.sort($verifiedBy, “Id”))
#resolveName($from)
#if($resolveName == $e.name) $r.Id $r.name #end
#end#end#end#end#end

I tried simplifying the above with the #foreach ($v in $tc.verifies) but no luck. In any case what I have is brute force but works.
rmartelli@rheinmetall.ca
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Wed Aug 14, 2019 7:24 am


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 1 guest