Moving Test Cases
When I go to the Script Editor, what is the script that gets affected? I want to write some code around what test cases can be moved and when but I don't know the script that it would go in. Any ideas?
Re: Moving Test Cases
treeleaf20, I'm afraid your post isn't very clear. I cannot tell what it is you're wanting to do.
Are you wanting to restrict which tests (from Test Plan) can be added to a test set (in Test Lab)? If that's the case, use the TestSet_CanAddTests function in the Test Lab module script. (Note, the names changed somewhat between QC 9.0 and QC 9.2, but this should get you close.)
This script, for example, prevents the user from adding scripts to a test set if any selected script is not in Ready status in the Test Plan module:
On Error Resume Next
' Prevent addition of tests that are not in Ready status
strTests = ""
For Each intTestID In Tests
Set oTest = TestFactory(Cint(intTestID))
If oTest.Field("TS_STATUS") <> "Ready" Then
strTests = strTests & oTest.Name & vbCrLf
Set oTest = Nothing
If strTests = "" Then
' All tests in Tests were in Ready status. Allow the action.
TestSet_CanAddTests = DefaultRes
' At least one test is not in Ready status. Disallow the action.
TestSet_CanAddTests = False
' Trim off trailing CR and LF
strTests = Left(strTests, Len(strTests) - 2)
' Set proper singular/plural ending and verb
If InStr(strTests, vbCrLf) > 0 Then
' There is more than one test
strS = "s are"
' There is only one test
strS = " is"
MsgBox "All tests must be in Ready status." & vbCrLf & vbCrLf _
& "The following test" & strS & " not in Ready status:" _
& vbCrLf & strTests, vbExclamation, "Tests Not Ready" ' 48
On Error GoTo 0
Hope this helps.
Re: Moving Test Cases
Thanks fo rthe help but I'm actually trying to limit moving test cases between folders in Test Plan. So I have two folders. One are test cases that are being written and another that is an obsolete folder. Only approved test cases can be moved to this folder by the Test Lead group (it's a custom group we created). After further research I don't think this can be done because there is no Action event that gets triggered but if you have any ideas on how to do it that would be great! Thanks for the help.