Is it possible to control which tests are added to a test set based on the TS_STATUS parameter of the test? i.e., I want to ensure that only if Status is "Ready", the tests can eb added to the test set. I tried using the TestLab_TestSet_CanAddTests(Tests) function in the workflow, but I am unable to retrieve the status using the tests(0) parameter - please let me know if there is a way to do it.
Re: Adding tests to test set based on Status field
I'm not sure that Tests indexes start at 0. I'd use LBound(Tests) and UBound (Tests) to walk through that array.
The Tests elements are test ids. To retrieve the status of the ith selected test, I'd use TDConnection.TestFactory.Item(CLng(Tests(i))).
So, that would give us :
Dim i, tst, Msg
Msg = ""
For i = LBound(Tests) to UBound(Tests)
Set tst = TDConnection.TestFactory.Item(CLng(Tests(i)))
If tst.Field("TS_STATUS") <> "Ready" Then
Msg = Msg & vbCrLf & tst.Field("TS_NAME")
Set tst = Nothing
If Msg <> "" Then
MsgBox "You cannot add the following tests:" & Msg
TestLab_TestSet_CanAddTests = (Msg = "")
Now, I'm not sure that it's a good idea to check the status of the test when it is added to the test set as users can change that status afterwards. It may be better to stop users from executing non ready tests. This topic on TDForums discusses that issue.