The best way to send the resulting report via email is probably via
the command line, either as a build step or by extending the
runtest.cmd batch file. There are several command line tools for
Windows that can send email and there are also solutions that use PowerShell. A quick google search according to you requirements should throw up a lot of usable results. I'm not sure if all of the solutions will support attachments though.
Presuming you find a suitable command line tool, it's also important to ensure that the name of your report file is static
so you can send it. The report output using the template specified
in the <Settings> element of your .srprofile is generated
with a time stamp in the file name. However, you can define
additional reports in the <Report> element, and the
outputName for the Template can be static in this case. The latest
SpecRun release candidate on NuGet (1.6.0-rc002) introduces options
that handle what to do if a report with the same name already
exists. You can install the preview version from the NuGet Pack
Manager in VS if you enable the "Include prerelease" option.
The <Template> element now includes an additional
attribute, existingFileHandlingStrategy, which can have the
following values:
- Overwrite (default): Overwrite existing files with the same
name (you will want to use this option)
- IncrementFilename: Follows the Windows paradigm of adding an
incremental suffix (e.g. "(1)", "(2)" etc.) to the end of file
names. This will retain the existing file with its original name
and result in a new file being generated with the appropriate
incremental suffix.
1.5.2 does unfortunately does not handle existing report files well, hence
the new options.
I'm assuming you
are not looking to send the report via email when executing tests
from within VS (where a link to the report is including in the
Output window).