Sending Mail when a Test Plan Module Field Value Changes

The example below demonstrates mail notification when the value of the status field is changed in the Test Plan module.

The code is added to the Test_FieldChange event procedure. It constructs a subject and comment for the email, and calls a user-defined function, SendTest. SendTest sends mail from the Test Plan module. You can code SendTest similarly to the SendDefect subroutine shown in Sending Mail when a Defect is Submitted.

Sub Test_FieldChange(FieldName)
        On Error Resume Next
        Dim strSubject, strComment
        If FieldName = "TS_STATUS" Then
            strSubject = "Test Change Notification" & _
                " for project " & TDConnection.ProjectName & _
                " in domain " & TDConnection.DomainName
            strComment = "The user " & User.FullName & _
                " changed the status of the test " & _
                Test_Fields("TS_NAME").Value & _
                " to " & Test_Fields("TS_STATUS").Value
            SendTest Test_Fields("TS_TEST_ID").Value, _
                Test_Fields("TS_RESPONSIBLE").Value, "[QA Testers]", _
                strSubject, StrComment
        End If
End Sub