How to use TestReport to append customer result message

Class library usage, coding and language questions.
jet
Posts: 7
Joined: Thu Aug 25, 2011 11:02 am

How to use TestReport to append customer result message

Post by jet » Tue Oct 11, 2011 8:18 am

hi all.
I have a requirement that i want to capture test report message as more as possible,e.g. i made serval test cases on a winform application.
The application would throws exception or show a error dialog dure the testcases running.When it throws a exception then it send the exception message to testcase executable file via .net romting client.If the testcase executable file receive the message then it appended the message to the report file,but if i use Report Class to log and append the message ,the report file was applied another xsl file,which it's content didn't including <activity> and it's style was not includes hierarchy and pie chart.Ok, then i try to use the TestReport,and the report file sytle was meet my requirement,the exception message which receive form the winfrom remoting client side was shown in the console ,but it was not append to the report file.
the code as follow:


public string ReportException(object message)
{

//XmlLogger.SetReportStylesheetFile("./log/RanorexReport3.xslt");
//XmlLogger.ReportStylesheetUrl="./RanorexReport3.xsl";

TestReport.Setup(ReportLevel.Failure,_loggerFileName,true);
TestReport.EnableTracingScreenshots = false;
TestReport.ReportWriteInterval = 0;
XmlLogger.AppendExisting=true;

using (new ActivityContext(new TestCaseActivity("STUDIOEXCEPTION","", "", "", 0, 0, null, "", null)))
{
using (new ActivityContext(new TestModuleActivity("testmodulename", "", "", ModuleType.UserCode)))
{

Report.Failure(message.ToString());
}

Report.Failure("");

}



Report.SystemSummary();

TestReport.SaveReport();
Report.End();
return message.ToString ();
}

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: How to use TestReport to append customer result message

Post by artur_gadomski » Wed Oct 12, 2011 10:13 am

Looks like you're missing Suit activity. And I find using TestReport.BeginTestSuite(),TestReport.BeginTestCase(), TestReport.BeginTestModule(),TestReport.EndTestModule(),TestReport.EndTestCase() a lot easier than activities.