Forum Discussion
mcbootus
15 years agoContributor
Dear Henrik,
Thank you very much for your code - it works very well - but I forgot to mention that the collection of the list happens one at a time via an incremental loop which collects the data on one pass then increments the XPath[] to collect the next block - so on every loop step we need to pass the list data into the array.
In our scenario we have created a loop which calls the property transfer to populate the list - so on each pass of the loop one list is created like so:
// loop the number of tag blocks - where r is the number of blocks which is determined by an XPath count (1-500 subtag blocks)
while( x < Integer.parseInt(r) ){
x++
// increment the block number to test each subtag block - this increments the Xpath [] to collect each block of data
testRunner.testCase.getTestStepByName('PropertiesXML').setPropertyValue("block number","${x}")
// Run the write to XML routine to write XML values to the properties file - this collects the data from the WS XML via XPath
testRunner.runTestStepByName("Write to XML")
// The Xpath values are stored in the properties file
a = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("block number")
b = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("code")
c = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("eventDateTime")
d = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("comment")
e = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("transmissionStatus")
f = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("transmissionVersion")
// The Xpath values are taken from the properties file to create a list
myList = [a,b,c,d,e,f]
// Add the myList to the Master array in block x
xxxxxxxxx
}
As you can see, on each pass of the loop I need to add the myList to an array - and since the number of list blocks is random (1-500 blocks) we have to create a dynamic array to account for the blocks - then we can collect all the block data before executing the sorting of the dates.
How can I add each myList loop step to the array in position x please?
Many thanks for your excellent help!
Armen
Thank you very much for your code - it works very well - but I forgot to mention that the collection of the list happens one at a time via an incremental loop which collects the data on one pass then increments the XPath[] to collect the next block - so on every loop step we need to pass the list data into the array.
In our scenario we have created a loop which calls the property transfer to populate the list - so on each pass of the loop one list is created like so:
// loop the number of tag blocks - where r is the number of blocks which is determined by an XPath count (1-500 subtag blocks)
while( x < Integer.parseInt(r) ){
x++
// increment the block number to test each subtag block - this increments the Xpath [] to collect each block of data
testRunner.testCase.getTestStepByName('PropertiesXML').setPropertyValue("block number","${x}")
// Run the write to XML routine to write XML values to the properties file - this collects the data from the WS XML via XPath
testRunner.runTestStepByName("Write to XML")
// The Xpath values are stored in the properties file
a = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("block number")
b = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("code")
c = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("eventDateTime")
d = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("comment")
e = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("transmissionStatus")
f = testRunner.testCase.testSteps["PropertiesXML"].getPropertyValue("transmissionVersion")
// The Xpath values are taken from the properties file to create a list
myList = [a,b,c,d,e,f]
// Add the myList to the Master array in block x
xxxxxxxxx
}
As you can see, on each pass of the loop I need to add the myList to an array - and since the number of list blocks is random (1-500 blocks) we have to create a dynamic array to account for the blocks - then we can collect all the block data before executing the sorting of the dates.
How can I add each myList loop step to the array in position x please?
Many thanks for your excellent help!
Armen