Page 1 of 1

Programmatically accessing Ranorex report elements

Posted: Thu Jul 07, 2016 3:05 pm
by rezme
Hi all, I'm currently working on a project integrating TestRail into our Ranorex automation, and it's been going well so far, but I've run into something that google has been unable to supply an answer to, thus far.

At the end of each test case, I have a module that grabs the status of the test, and then submits that status to TestRail, so the results update in realtime as the tests progress. I'm able to supply the status of the case, and get that sent to TestRail, but the detail information that ends up in the TestRail report is sparse at best. I'd like to make use of the details in the Ranorex report, but so far I'm not able to get more than just the "Description" field for each module that sits within the test case (but not those within the "Setup" and "Teardown" portions).

I was able to find a forum post http://www.ranorex.com/forum/test-suite ... t2064.html that got me partway there. The code I'm using to grab this information is listed below

Code: Select all

foreach (IReportItem rep in TestReport.CurrentTestCaseActivity.Children)  
{					
	if(rep.ToString() == "Ranorex.Core.Reporting.TestModuleActivity")
	{
		string DetailMessage = (rep as TestModuleActivity).DetailMessage;
		string ErrorMessage = (rep as TestModuleActivity).ErrorMessage;
		string Status = (rep as TestModuleActivity).Status.ToString();
		TestCaseReport += "\r\n\r\n" + DetailMessage + " - " + Status;
						
		if(Status.ToLower() != "success")
		{
			TestCaseReport += " - " + ErrorMessage;
		}
	}						
}
What I'm trying to get is the detailed report for each module, or more accurately, the text of that detailed report. I'm not concerned with screenshots, and I already have the means to pull any error messages... but those error messages aren't helpful without context. The context can be established within the saved Ranorex report file, but I have to wait until all tests complete to have access to that data, so that eliminates the "realtime reporting" aspect of the project, which is sort of the point to begin with. The information has to be there, because it's being collected throughout the test process. I'm hoping that someone out there has done something similar, and can advise as to where I can pull the text I'm looking for.

Image

Re: Programmatically accessing Ranorex report elements

Posted: Fri Jul 08, 2016 10:27 am
by swmatisa
HEllo,

I do something similar http://www.ranorex.com/forum/ranorex-re ... tml#p11489

Hope this helps

Re: Programmatically accessing Ranorex report elements

Posted: Wed Jul 20, 2016 3:48 pm
by rezme
Checked out your code, and it appears just to deal with status. I'm able to get the test case status with no issues, what I'm trying to get is the text that appears in each step at the end in the ranorex report. Basically a text based ranorex report. I have to get this during runtime, as the last step in the teardown, and it has to be the text of the current test case only.

As a workaround, I tried converting the ranorex report to PDF during runtime, but because the ranorex report doesn't finalize until after all the steps have run, the PDF conversion fails every time.

The description is nice, but if I have a module that's usercode, and I've used "report.failure" within it, all that shows is the description of the step, and that it failed, but no pertinent data as to why. The idea is to present this data to management in testrail, to update them in realtime as to the status of our smoke/acceptance tests.

Re: Programmatically accessing Ranorex report elements

Posted: Fri Jul 22, 2016 12:06 pm
by Support Team
Hi Rezme,

Unfortunately, the most parts of our Ranorex Report are covered with internal (non documented) API, which can change within every new release of Ranorex. Therefore, the usage of this API if officially not supported.

Thank you for your understanding.

Regards,
Markus (S)