Send mail from test set to test designer ( From test plan)

I am trying to send mail to test designer from test set when a status is changed. I could able to send groups like admin, but not to test designer.

Dim rs, rst
On Error Resume Next

If TestSetTest_Fields("TC_STATUS").IsModified Then
If TestSetTest_Fields.Field("TC_STATUS").Value = "Ready to start" Then
Set rs = TDConnection.TestSetFactory
Set rst = rs.Item(TestSetTest_Fields.Field("TC_CYCLE_ID").Value)
Set TS = TDConnection.TestFactory

' Send email notification
Dim responsibleUser
responsibleUser = TS.Test_Fields("TS_RESPONSIBLE").Value

If responsibleUser <> "" Then
rst.Mail responsibleUser, "", 0, "The Test Case " & rst.Name & " Status Changed to __Ready to Start__"
Else
' Handle case where there is no responsible user
rst.Mail "[TDAdmin]", "", 0, "The Test Case " & rst.Name & " Status Changed to __Ready to Start__ but no responsible user was found."
End If

' Cleanup
Set rst = Nothing
Set rs = Nothing
End If
End If

On Error GoTo 0 ' Reset error handling

  • 0

    Any update.. 

  • Verified Answer

    +1

    Hi

    i dont understand something.

    a test set has status yes, but does not have a designer,
    a test set test (test intance) has status and its test case has a designer

    if you want when a instance change status, send a email to the intance test designer, here the code to ad  in the testsettests_fienlcandchange function.

    this will work when you change this: 

    and NOT this

    Function TestSetTests_FieldCanChange(FieldName, NewValue)
      On Error Resume Next
      If FieldName = "TC_STATUS" Then
         If Not NewValue =  TestSetTest_Fields("TC_STATUS").Value Then
            Set TestOBJ = TDConnection.TestFactory.Item(TestSetTest_Fields.Field("TC_TEST_ID").value)
        toUser = TestOBJ.Field("TS_RESPONSIBLE")
        If toUser <> "" then
          TDConnection.SendMail toUser,,"SI reponsable", emailhtml, Null, "html"
        Else
          TDConnection.SendMail "[TDAdmin]",,"no reponsable", emailhtml, Null, "html"
        End If
         End If
      End If
    
      TestSetTests_FieldCanChange = DefaultRes
      On Error GoTo 0
    End Function

  • 0 in reply to 

    Thanks, Exactly the same I was looking for.