Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
garzaacb Regular Contributor.
Regular Contributor.

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

  1. 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.  
  2. 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.

1 Reply
Knowledge Partner Knowledge Partner
Knowledge Partner

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.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.