'Duration' in Ranorex Report

Ask general questions here.
User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

'Duration' in Ranorex Report

Post by artur_gadomski » Tue Jun 28, 2011 7:52 am

Hi
In ranorex report in 'system information' part there is an item called 'duration'. How does one make it work when writing tests in VS2010? It always shows 0ms for me.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: 'Duration' in Ranorex Report

Post by Support Team » Tue Jun 28, 2011 2:42 pm

Hi,
artur_gadomski wrote:In ranorex report in 'system information' part there is an item called 'duration'. How does one make it work when writing tests in VS2010? It always shows 0ms for me.
If you use a Ranorex Test Suite file, then this duration will be set automatically, because this property depends on how long the test suite run. So you have to use a rxtst file or you could use one of following solutions posted by our forum users:
http://www.ranorex.com/forum/how-to-mea ... t1682.html
http://www.ranorex.com/forum/capturing- ... t2299.html

Regards,
Peter
Ranorex Team
.
Image

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

Re: 'Duration' in Ranorex Report

Post by artur_gadomski » Tue Jun 28, 2011 3:15 pm

My code looks like this:
Ranorex.Controls.ProgressForm.Show();
            
TestReport.Setup(ReportLevel.Debug, pathToReport, true);
TestReport.BeginTestSuite("suite");

//my code including 
TestReport.BeginTestModule("Uninstall");
//and
TestReport.EndTestModule();

TestReport.SaveReport(); 
Report.End();
And even if I was to count the time myself, could I put it in this 'duration'?
btw time is properly counted and reported for test modules.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: 'Duration' in Ranorex Report

Post by Support Team » Tue Jun 28, 2011 10:31 pm

Hello,

the reporting of duration is part of the activity stack that is created while a test suite is run.
You would have to use that. Here is a sample:
TestReport.Setup(ReportLevel.Info, filename, false);
using (new ActivityContext(new TestSuiteActivity("test suite report header")))
{
    using (new ActivityContext(new TestCaseActivity(("test case name"))))
    {
        using (new ActivityContext(new TestModuleActivity("test module name")))
        {
            Report.Error("error message");
            Report.Info("infor message");
        }
    }
}
TestReport.SaveReport();
Report.End();
Regards,
Roland
Ranorex Support Team
.
Image

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

Re: 'Duration' in Ranorex Report

Post by artur_gadomski » Wed Jun 29, 2011 8:04 am

I'd rather stay away from this using activity context, that's why I really like the startTestModule/Case and EndTestModule/Case methods. Why is there no EndTestSuite method?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: 'Duration' in Ranorex Report

Post by Support Team » Wed Jun 29, 2011 7:12 pm

Hello,

sure, ActivityContext is just an IDisposable to allow using syntax. It does the same as BeginTest{Suite,Module,Case}/End{Module,Case}. EndTestSuite is not there, because it corresponds to the end of the report, and that you do when you do SaveReport().

Regards,
Roland
Ranorex Support Team
.
Image