Loop as Data Rows in the Report

Class library usage, coding and language questions.
dpereira
Posts: 5
Joined: Wed Mar 22, 2017 3:17 pm

Loop as Data Rows in the Report

Post by dpereira » Mon Jun 12, 2017 8:17 pm

Hi all,

I have a code module written in C# with a loop iteration, such like this:

Code: Select all

for (int i=0; i<10; i++) {
      Report.Info("User Test",i.ToString());
}
I'd like to have my report file to get a new Data Row for each iteration since each iteration can fail or not. See image in attachment. How can I do that with the Ranorex API? is it even possible?

Thanks in advance
Attachments
report_ranorex.png
report_ranorex.png (8.06 KiB) Viewed 941 times

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Loop as Data Rows in the Report

Post by Vega » Mon Jun 12, 2017 11:01 pm

Maybe I'm misunderstanding your question, but its sounds like you want to go to the next row of data after execution in service disruption has completed an iteration? This is the standard behavior for Ranorex when using data binding out of the box, all you may need to do is modify the error behavior for your test case so that it continues on error.

I see from the image that you only have one row of data. Are you planning to add more or are you trying to modify the data connector during run time?

Data iteration:
https://www.ranorex.com/support/user-gu ... tml#c16079

Error behavior:
https://www.ranorex.com/support/user-gu ... tml#c16087

dpereira
Posts: 5
Joined: Wed Mar 22, 2017 3:17 pm

Re: Loop as Data Rows in the Report

Post by dpereira » Thu Jun 22, 2017 2:42 pm

Thanks for the prompty help. Let me explain better.
What I really want to do is to create the same report structure from data binding with iterations loops.

The report structure using data binding is something like this below where this example shows 10 rows. Look how the report is organized. Each row iteration has a test result.

[img]report.png[/img]

What I really what to do is to get the same report structure using loops. I'd like my report to have the same structure from data binding.
Look what happens when I execute this code below.
[img]loop_report.png[/img]
How can I make the report have the same layers from the picture above?
Attachments
loop_report.png
loop_report.png (11.01 KiB) Viewed 907 times
report.png
report.png (12.23 KiB) Viewed 907 times

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Loop as Data Rows in the Report

Post by Vaughan.Douglas » Thu Jun 22, 2017 4:13 pm

What version of Ranorex are you using? Ranorex 7.x has changed some of reporting functionality. Before you start anything too crazy, you might want to make sure you're running the current version of the tool.
Doug Vaughan

dpereira
Posts: 5
Joined: Wed Mar 22, 2017 3:17 pm

Re: Loop as Data Rows in the Report

Post by dpereira » Fri Jun 30, 2017 2:01 pm

Hi,

I am using the last version of Ranorex.
I couldn't find a useful way to work with the Report API. Any help will works :)

Thanks

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Loop as Data Rows in the Report

Post by asdf » Mon Jul 03, 2017 12:42 pm

Hi Dpereira,

I'm pretty sure that it is not possible to use a for loop as a data connector. May I ask you what exactly you are trying to achive? Maybe there is a proper workaround for your intention.

Best regards,
Asdf

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Loop as Data Rows in the Report

Post by Vaughan.Douglas » Mon Jul 03, 2017 3:27 pm

I'm going to have to agree with Asdf here. We need to better understand what you're really trying to accomplish.

Are you asking to do something like this:
for (int i=0; i<10; i++) {
      //Execute testcase with data from data source row "i"
}
That might get you something that looks more like your report.png image, but no matter how you slice it I don't see what if any advantage trying to manually do this would provide over the built in data driven approach provided by Ranorex.
Doug Vaughan

dpereira
Posts: 5
Joined: Wed Mar 22, 2017 3:17 pm

Re: Loop as Data Rows in the Report

Post by dpereira » Wed Jul 05, 2017 12:18 pm

Hi,

What I am trying to achieve is to get the report structure shown in the attachment.

I am looking for a way to divide the iterations in subtabs in the test report. I can't find more information on how I can work with the Report API.

I hope you guys have an idea now on what I am trying to do. If not, I can explain in other ways.

Thanks,
dpereira.
Attachments
expectations.png
expectations.png (13.68 KiB) Viewed 847 times

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Loop as Data Rows in the Report

Post by Vaughan.Douglas » Wed Jul 05, 2017 2:35 pm

Why do you need to use loops?
Doug Vaughan

dpereira
Posts: 5
Joined: Wed Mar 22, 2017 3:17 pm

Re: Loop as Data Rows in the Report

Post by dpereira » Thu Nov 23, 2017 4:32 pm

I don't want to use loops. Just want to use the Report API. :(

McTurtle
Posts: 191
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Loop as Data Rows in the Report

Post by McTurtle » Fri Nov 24, 2017 3:14 pm

Hello dpereira,

I think that the Report API is not what you need. In order to aggregate the results of the test run into a table view you will have to create a customer report template. The Ranorex user guide does not cover much about this topic: Create a Custom Report Template

I found a guide under the following link: How to Customize Report of Ranorex Tool?

However, I did not test this. Please take a look and let us know if this is what you were looking for. As mentioned in the guide, you will require quite some knowledge of HTML and XSLT. If you don't know anything about these, then I would suggest to you to stick with the default report.

Regards,
McTurtle