How Comfortable it will be when the mails will be send automatically whenever you run your test. The test results will be sent automatically to the manager or client with every details, you just need to click on Run button in Telerik Test Studio.
//Allows to send the mail
For more studying about the Microsoft Outlook Objects,Properties and Methods click here
Check the Code:
Well we know that the Microsoft Office is developed in the Object Model. So for accessing the office tools we will first create the instance and then we will use the Outlook Object.
If you want to see how the test report/test log can be created in Telerik Test Studio click here
Microsoft.Office.Interop.Outlook.Application outl07=new Microsoft.Office.Interop.Outlook.ApplicationClass();
//Microsoft Outlook Object is created names as outl07
Microsoft.Office.Interop.Outlook.MailItem
mail=
(Microsoft.Office.Interop.Outlook.MailItem)outl07.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
//Here the Outlook Object "MailItem is used".
// A object names as "mail" is created as the instance of the MailItem which will allow to use the different //properties such as Attachment, send, etc
mail.Attachments.Add("D:\\Test Result.xlsx");
//Allows to add the attachment
mail.To="abc@abc.com";
//Allows to enter the recipient
mail.CC="xyz@xyz.com";
//Allows to add the CC
mail.Subject="Test Result";
//Allows to add the subject
mail.Body=@"Hello,
PFA for the Test Result";
//Allows to add the body
mail.Send(); //Allows to send the mail
For more studying about the Microsoft Outlook Objects,Properties and Methods click here
No comments:
Post a Comment