Add Only Certain test Cases whos Status is Approved
The main goal is to prevent test cases that do not have an approved status to be placed into test lab. I had a couple of ideas for this
- When selecting test cases in test lab only display test cases with a Status of Approved in the Test Plan Tree when selecting test cases. This is the preferred method.
- Another solution is to prevent users from moving test cases into test lab by using the TestSet_CanAddTests(Tests) workflow. I found code in this article https://community.microfocus.com/t5/Quality-Center-ALM-User/ALM-Workflow-Customization-Problem/td-p/1005706. It works but does not work when selecting multiple tests. I have tried removing tests from the tests array but it still places all the tests in test lab. Now I am trying to figure out how to use the API to only add the tests that are approved but having a difficult time figuring out how to use it in the workflow.
Though I would prefer the first option, but if not possible I would like some direction for the second option.
Re: Add Only Certain test Cases whos Status is Approved
The first option has the problem that there no way to guarantee that users will set the filter that will only show the approved test cases.
The second option has the weakness that you have seen - either TestSet_CanAddTests will add all or none of the tests selected. What you could do is save the IDs of the non-approved tests and then let the workflow delete those test instances after creation. It might be a bit tricky to have it work safely.
Both options have the weakness that if a test case is first approved, added to test sets, and then modified again, I guess your process assumes it should be removed from Approved status. But this will not remove the test instances already created in Test Lab.
So I would say there is a third option that is easier to implement and more consistent: warn users when they try to run a non-approved test and do not allow them to save such a run.
[Please do not contact me off line for receiving support. Use the forum!]