Hi
I really like how the new report looks like, but since we're not using recordings and we co all out code in Visual Studio I was wondering if there is a way to achieve the same results with just coding.
New Report - how to code it?
- artur_gadomski
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
- Contact:
Re: New Report - how to code it?
Try this...
Code: Select all
using Ranorex.Core.Reporting;
//set up test report
TestReport.Setup(ReportLevel.Info, "report.rxlog", true);
TestReport.EnableTracingScreenshots = false;
TestReport.ReportWriteInterval = 0;
//show progress form
Ranorex.Controls.ProgressForm.Show();
//Shows Test Suite name and running test name in progress form
using (new ActivityContext(new TestSuiteActivity("TestSuiteName", "", 0, null, "", "")))
{
using (new ActivityContext(new TestCaseActivity("TestName", "", "", "", 0, 0, null, "", null)))
{
}
}
Report.Info("Hello");
TestReport.SaveReport();
- artur_gadomski
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
- Contact:
Re: New Report - how to code it?
Thx. This took us half way and we were able to go to about 99% from there on our own. Final code is:
TestReport.Setup(ReportLevel.Debug, "report.rxlog", true); TestReport.EnableTracingScreenshots = false; TestReport.ReportWriteInterval = 0; //show progress form Ranorex.Controls.ProgressForm.Show(); using (new ActivityContext(new TestSuiteActivity("Test Suite Name", "", 0, null, "", ""))) { using (new ActivityContext(new TestCaseActivity("Test Case Name", "", "", "", 0, 0, null, "", null))) { using (new ActivityContext(new TestModuleActivity("Test Module Name", "", "", ModuleType.UserCode))) { Report.Info("Message"); Report.Failure("Message"); } Report.Failure(""); // Causes test case to have failure status. } } TestReport.SaveReport();We still don't know how to make this fancy Circle with test status, or why we need secodn report failure/success in test case level, but what we have looks good enough for now.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: New Report - how to code it?
As you can see the new Reporting API is a bit ugly because it is only used by the Ranorex test suite code internally
But since a lot of people seem to be using it outside of the Ranorex Studio test suite, we will add a few overloads, utility methods, api doc and generally clean it up a little. There might also be a blog on how to use those fancy circles
These (non-breaking) changes will then probably make it into 3.0.1 and/or 3.0.2
Any suggestions are of course welcome.
@artur
You can set the current activity status by setting ActivityStack.Current.Status = ...
Then you dont need to do the rather weird Report.Failure() call.
Michael
Ranorex Team
But since a lot of people seem to be using it outside of the Ranorex Studio test suite, we will add a few overloads, utility methods, api doc and generally clean it up a little. There might also be a blog on how to use those fancy circles
These (non-breaking) changes will then probably make it into 3.0.1 and/or 3.0.2
Any suggestions are of course welcome.
@artur
You can set the current activity status by setting ActivityStack.Current.Status = ...
Then you dont need to do the rather weird Report.Failure() call.
Michael
Ranorex Team