log before first iteration
Posted: 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:
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());