Trying to retrieve a property based on the value of another property in the Properties test step
I have 2 Properties test steps set up in one of my test suites. And right now I need to retrieve values from the 2nd Properties test step based on a serial number from the first Properties test step.
So, in my groovy script, I am processing through the information from the first Properties step which is something like :
Row 1 : 1
Serial Number 1 : 12345
Time 1 : <timestamp 1>
Row 2 : 2
Serial Number 2 : 12346
Time 2 : <timestamp 2>
Row 3 : 3
Serial Number 3 : 12345
Time 3 : <timestamp 3>
whereas in Property Step 2 it looks like :
Row 1 : 1
Serial Number 1 : 12345
Count 1 : 0
Row 2 : 2
Serial Number 2 : 12346
Count 2 : 0
Row 3 : 3
Serial Number 3 : 12347
Count 3 : 0
Now, I need to update the Count value of Properties step 2 whenever I encounter the serial number in Properties step 1. Is there any way to do that without it getting messy..?? Also, the properties, when loaded, are sorted based on other fields, not based on the serial numbers.
eventually this is what I ended up doing :
if(incCount == true) { //Count the number of times an account number is used for financial transactions on the day and //updated the "Count" in the Settlements property step def propertySettlements = testRunner.testCase.getTestStepByName("Settlements") paddingNum = propertySettlements.getPropertyValue("DataRowCount").length() for(def testProperty in propertySettlements.getPropertyList()) { if(accnum in testProperty.value) { def padFlag = testProperty.name.substring(testProperty.name.length()-paddingNum) int newVal = propertySettlements.getPropertyValue("Count " + padFlag).toInteger() newVal++ propertySettlements.setPropertyValue("Count " + padFlag, newVal.toString()) } } }