Query to remove test coverage from Requirement
Question ID: 108376
0
0

Hello, We have accidentally added ALL of our test cases to a requirement. I was wondering if there was a query available to remove all the test coverage from this one requirement. There are 21,000 links and is timely to do it manually. This is in the REQ_COVER table.

Marked as spam
Posted by (Questions: 113, Answers: 8)
Asked on May 2, 2018 8:32 pm
57 views
Answers (1)
1
Private answer

I would not advise going in and just running a query. Not only were the tests added to the coverage but the test configurations are also linked now. This workflow below will allow you to create an icon on the requirements tool bar that will allow you to removed the coverage for both the tests and test configurations.

The first step is to create a button in the Requirements Module Customize --> Workflow --> Script Editor --> Toolbar Button Editor

- select Requirements in the Command bar drop-down
- click the Add button
- enter a Hint if needed and Select an icon image
- click Apply

*** Make a note of the action name in this case it is Requirements_Action1 you will need to update it in the workflow below if it is different ***

Finally, add the following under Customize --> Workflow --> Script Editor --> Common script --> ActionCanExecute(ActionName)

If ActionName = ''Requirements_Action1'' then
Ans = msgbox(''You are about to remove a requirement coverage for all tests!'' & vbCrLf & ''Are you sure you want to do this?'', vbYesNo + vbExclamation + vbDefaultButton2, ''Warning'')
If Ans = vbYes Then
Dim thisTestList 'Holds list of tests covering this requirement
Dim aTest 'The test from thisTestList that the requirement is being removed from
Dim thisReqFact 'Services for managing requirements
Dim thisReqFilter 'The TDFilter object for the requirement factory
Dim thisReqList 'List of object according to specified filter ()
Dim aReq 'The current requirement from the thisReqList
Dim thisReqID 'Holds the requirement ID for the TDFilter
thisReqID = InputBox(''Enter the Requirement ID to remove coverage'', ''Requirement ID'') 'Prompts user for requirement ID to use in filter
Do while thisReqID = '''' Or NULL
thisReqID = InputBox(''You did not enter a requirement ID!'' & vbCrLf & ''Enter the Requirement ID to remove coverage'', ''Requirement ID'')
Loop
set tdc = TDConnection
set thisReqFact = tdc.ReqFactory 'Creates the requirement factory
set thisReqFilter = thisReqFact.Filter 'Creates the TDFilter for creating the list of requirements
thisReqFilter.Filter(''RQ_REQ_ID'') = '''' & thisReqID & '''' 'Sets the Filter used (the '''' at the beginning and end forces the variable to be evaluated as a string)
set thisReqList = thisReqFact.NewList(thisReqFilter.Text) 'Creates the filtered list of requirements
For Each aReq in thisReqList 'Loops throught the list of requirements one at a time
set thisTestList = aReq.GetCoverList() 'Gets the list of tests covering this requirement
msgbox ''There are '' & thisTestList.Count & '' test covering the requirement'' 'displays the number of tests covering the requirement
For Each aTest in thisTestList 'Loops the lists of tests
aTest.RemoveCoverage(aReq) 'removes the coverage
Next
Next
End If
End If

***Directions:***
When you click on the icon image that was added to the requirements tool bar you will be prompted whether or not you want to remove the coverage for all tests for the requirement. Next you will be prompted for the requirement ID. A message box telling the number of covering tests will display (click OK). The covering tests and test configurations will be removed.

Marked as spam
Posted by (Questions: 0, Answers: 309)
Answered on May 2, 2018 8:38 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top