deepak_kumar's avatar
deepak_kumar
New Member
4 days ago
0
Status:
New Idea

To send report after execution of Test Cases report should be send by outlook on mail.

To send report after execution of Test Cases report should be send by outlook on mail. 

1 Comment

  • I have this code set in an event in all of my test complete projects.  It is controlled by a bool variable in the project.  You will need to ensure you have permission on a local server to do this.

    P.S.  If you find my posts helpful give me a like and be sure to mark a 'Best Answer' to give credit and help others with the same questions!

    function Email_Event (str_Message = "No Test Message Supplied. ")
    {
      if (Project.Variables.bEvent_Email){
        SendEmail(  /*Recipient*/
                    Project.Variables.strEmail_Rcpt,
                    
                    /*Mail Server*/ 
                    "mail.wwwoodproducts.com",
                    /*Senders Name*/ 
                    "TestComplete",
                    /*Senders Address*/ 
                    "Testing@wwinc.com",
                    /*Subject*/ 
                    "WWCabinetOrder, Test Case: " + aqTestCase.CurrentTestCase.Name,
                    /*Body*/ 
                    str_Message + aqTestCase.CurrentTestCase.Name + "' failed " +
                    " Running on: " + Sys.HostName);
                    //" Running on: " + Sys.HostName +                    
                    //"\n\rThis is a TEST error sent to " + Project.Variables.strEmail_Rcpt);
      }     
    }
    
    function SendEmail(str_RcptAddr, str_Server, str_SenderName, str_SenderAddr, str_Subj, str_Body, str_Files = null)
    {
      var b_Result = false;
      if (str_Files == null){  
        if (SendMail(str_RcptAddr, str_Server, str_SenderName, str_SenderAddr, str_Subj, str_Body)){
            Log["Message"]("Mail was sent");
            var b_Result = true;
        }
        else{
            Log["Warning"]("Mail was not sent");
            var b_Result = false;
        }
      }
      else{
        if (SendMail(str_RcptAddr, str_Server, str_SenderName, str_SenderAddr, str_Subj, str_Body, str_Files)){
            Log["Message"]("Mail was sent");
            var b_Result = true;
        }
          else{
            Log["Warning"]("Mail was not sent");
            var b_Result = false;
        }
      }
    }