log before first iteration

Ask general questions here.
kathrin
Posts: 13
Joined: Wed Mar 15, 2017 11:27 am

log before first iteration

Post by kathrin » Wed Mar 15, 2017 12:07 pm

Hello,

I often use SQL-DataConnectors in my solution as DataSource for multiple iterations. I would like to show the used data in the report before the first iteration starts. So it would be possible to see wich data is used in the iteration without toggeling all to "testdata".

The function (see below) works fine but i don't know where to put it to achieve that. In the report i want somthing like:

Testcase
Data-Table
Iteration 1
Iteration 2

Thanks, Kathrin

function to create the report:

Code: Select all

TestCaseNode tc = TestCaseNode.Current;
SqlDataConnector con = (SqlDataConnector)tc.DataSource;

StringBuilder table = new StringBuilder();

ColumnCollection cols;
RowCollection rows;
con.LoadData(out cols, out rows);
				        		
table.Append("<table width='100%' border='1'" +
                " style='border-collapse:collapse;" +
                "border-color:#000000;" +
                "border-width:1px;'>");
table.Append("<tr>");
cols.ToList().ForEach(c => {
  table.Append("<th>" + c.Name + "</th>");
});

table.Append("</tr>");

rows.ToList().ForEach(a => {
  table.Append("<tr>");
  cols.ToList().ForEach(c => {
    table.Append("<td>" + a[c.Name] + "</td>");
  });
  table.Append("</tr>");
});
							  
table.Append("</table>");

Report.LogHtml(ReportLevel.Info, "DataSource", table.ToString());
K
-----------------------
:arrow: Ranorex 9.3
:arrow: Ranorex Certified Professional (01/2017)
:arrow: ISTQB Certified Tester Foundation Level (07/2018)

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

Re: log before first iteration

Post by asdf » Wed Mar 22, 2017 12:44 pm

Hi Kathrin,

Have you tried to simply log the information to the report directly with a Report-action at the beginning of your tests?
Variable.png
You could also log the variable directly in your program.cs before the TestSuite starts.
2017-03-22 12_43_47-UsedVar - Ranorex Studio.png
Hope this helps.

Kind regards,
asdf
You do not have the required permissions to view the files attached to this post.