October 7, 2010
Automatically Emailing TestTrack Reports
I wrote a sample application that can send a TestTrack report to one or more email addresses. This is a console application, so you can create a batch file and use Windows Scheduler to run it at pre-determined times. The application is written in C# using the .NET framework version 3.5. The email is sent using the System.Net.Mail namespace, specifically, the SmtpClient class. If you're not sure whether this will work in your environment, you can find more information here. If the report consists of a single file, the HTML file will be attached to the email. If the report includes images and consists of more than one file, all the corresponding files will be zipped and attached to the email. To zip the files, I used the free library available here. Keep the following in mind:Email sign up
- This application will not support an SMTP host that requires authentication.
- This is a sample application that is not supported by Seapine. I tested it on my computer but variations, such as the version of TestTrack or .NET you are using, may reveal a bug that I am not aware of. The sample source code is provided in case you run into any issues and want to modify it.
- The application is written in C# using .NET libraries for sending emails and zipping the files. A different approach may be needed for something like Java, PERL, or Python. However, the TestTrack SOAP portion of the code should serve as a model to translate this into your favorite language.
- To run reports via SOAP, you need to configure an alternate temporary path due to an issue between the SOAP CGI and IIS. In TestTrack 2011 and later, you can configure a separate temp directory for the SOAP CGI using the TestTrack registry utility. Start the TestTrack registry utility on the computer the TestTrack web server was installed on. Under CGI Options you will find a new SOAP Options section that will allow you to configure an alternate temporary path.
- The TestTrack Report Name
- The email addresses to send the report to; if more than one address is used, use a semi colon as a delimiter
TTEmailReport "Most Reported" "[email protected];[email protected]"The application gets the remaining information it needs from the configuration file, which contains the following information:
- TestTrack username
- TestTrack password
- TestTrack SOAP URL
- TestTrack Project name
- Return Address
- Return Display Name
- SMTP host