Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

Loop Through Array Returned by Script in Keyword Test

$
0
0

I've written a large amount of script which use arrays to reduce the the data reads from the Excel spreadsheat and improve performance. I recently discovered that, unlike keyword tests, script references don't get renamed when objects are renamed and want to move this logic into keyword tests. However, I can't figure out how to interate through the array within the Keyword test. I'm storing the array in the Keyword a variable (AllCribs) and verified the values are correct (second image). However when attempting either a loop or forloop I'm receiving the exception 'The variable specified as the Loop Counter is of an invalid type. Expected types: Integer, Double'. What am I doing doing wrong?

 

Here's the script:

//
// Return list of ALL cribs
//
function ReadAllCribs() {
	var AllCribs = [];

	Project.Variables.Cribs.Reset();
	while (!Project.Variables.Cribs.IsEOF()) {
		AllCribs.push(Project.Variables.Cribs.Value("CribNumber"));

		Project.Variables.Cribs.Next();
	}
	return AllCribs;
}

 And here's the Keyword test

ForLoop.jpg


Viewing all articles
Browse latest Browse all 21061

Trending Articles