Forum Discussion
Here's the XLSx file. I have replaced actual data with mock data. There are 25 rows.
params is the variable defined in the project
Here's the complete code:
const sheet = Project.Variables.params;
sheet.Reset();
while (!sheet.IsEOF()) {
id = sheet.Value("ID");
if (id == Project.TestItems.Current.Iteration) {
obj = JSON.parse(sheet.Value("JSON"));
break;
}
sheet.Next();
}
sheet.Disconnect();
Please note that this is a very intermittent issue.
I'm assuming you are using the Execution Plan? I ran 100 iterations (Count is 100) and no errors were shown.
As you are opening and closing the Excel document many times, the internal object may not have been fully cleared. This could cause the issue.
I'm not sure if you are doing data driven, but calling this snippet of code, will eventually slow things down. In this example, it will iterate 7 rows, then match the 8 row based on current iteration.
- MadhuLambu2 months agoContributor
I haven't seen the issue often, but it does pop now and then and it causes the long running tests to stop.
Yes, this is data driven by matching the iteration number with the ID value. You are right about the slowness of the logic. Please do share your thoughts on better ways to do data driven.
- rraghvani2 months agoChampion Level 3
See https://support.smartbear.com/testcomplete/docs/testing-with/data-driven/drivers.html
It will be similar to,
function main() { const sheet = Project.Variables.Var1; sheet.Reset(); while (!sheet.IsEOF()) { // Read your inputs var id = sheet.Value("ID"); var obj = sheet.Value("JSON"); // Populate your fields // Move to record sheet.Next(); } sheet.Disconnect(); }
Related Content
- 3 months ago
Recent Discussions
- 9 hours ago