views:

54

answers:

2

Can I send the VSTS 2008 test results by email automatically after test run?

+1  A: 

Hi, you can send email with notification and report attached. I guess, you can you can create stored procedure and run them at the end of the test execution for gathering required data. After that you can create .xml or Excel file with result of created procedure and attached it to email. So, you need to create load test plug-in:

namespace LoadTestPluginTest { public class MyLoadTestPlugin : ILoadTestPlugin { LoadTest myLoadTest;

    public void Initialize(LoadTest loadTest)
    {
        myLoadTest = loadTest;
        myLoadTest.LoadTestFinished += new
            EventHandler(myLoadTest_LoadTestFinished);
    }

    void myLoadTest_LoadTestFinished(object sender, EventArgs e)
    {
        try
        {
            // place custom code here
            MailAddress MyAddress = new MailAddress("[email protected]");
            MailMessage MyMail = new MailMessage(MyAddress, MyAddress);
            MyMail.Subject = "Load Test Finished -- Admin Email";
            MyMail.Body = ((LoadTest)sender).Name + " has finished.";

            SmtpClient MySmtpClient = new SmtpClient("localhost");
            MySmtpClient.Send(MyMail);
        }

        catch (SmtpException ex)
        {
            MessageBox.Show(ex.InnerException.Message +
                ".\r\nMake sure you have a valid SMTP.", "LoadTestPlugin");
        }
    }
}

}

Here is the description of LoadTest DB tables http://blogs.msdn.com/billbar/articles/529874.aspx

Julia
+1  A: 

Here you can download "Email Reporter: VSTS 2008 Load Test Plug-in" http://code.msdn.microsoft.com/erep It's a very helpful post by Mohammad Ashraful Alam.

Julia