Here are some posts that could help you:
I did not try it but they sound like to be what you are looking for.
EDIT:
Just for the case the links above get broken someday:
Adding custom data to trx result file
You can add a TestProperty attribute to your TestMethod and it will appear in your trx file.
[TestProperty("Severity", "1")]
Thanks,
Anuj
Marked as answer by singhhome Friday, August 20, 2010 2:34 PM
Friday, August 20, 2010 5:53 AM
Adding additional test result information.
To add an additional file in TRX file- You can add this with the help of following method present in TestContext for every test.
TestContext.AddResultFile(filePath)
where filePath is the path of the file you want to add in the test result file.
To get the TestResult file name during the test run- You can use following property to get this
TestContext.TestRunDirectory
It'll give you the directory name where the logs are stored for the test run with the complete path. For a test run the directory name and the trx file name would be same hence if you concatenate this string with .trx you can very well access the test result file.
Following is a sample code snippet.
[TestMethod]
public void CodedUITestMethod1()
{
//add a file stored at c:\ location to the test result file
this.TestContext.AddResultFile(@"c:\file.bmp");
//Print the trx file name
string testRunDirectory = TestContext.TestRunDirectory;
string testRunTRXFileName = String.Concat(testRunDirectory, ".trx");
Console.WriteLine("TestResult file : " + testRunTRXFileName);
}
Proposed as answer by Deepak.Singhal [MSFT]Microsoft employee Wednesday, February 10, 2010 1:32 PM
Marked as answer by Flying_Tiger Wednesday, February 10, 2010 1:52 PM