mardi 30 août 2016

Multiple values from same txt file

I've been using this script to load values separated by new line from files to send requests with different values.

def size 
File valueFile = new File("C:\\values\\myValueFile.txt")
File valueFile2 = new File("C:\\values\\myValueFile2.txt")
List lines = valueFile.readLines()
List lines2 = valueFile2.readLines()
size = lines.size.toInteger()
def myProps = testRunner.testCase.getTestStepByName("MyProperties") 

for( counter in 0..size-1) 
{
tempValue = lines[counter]
tempValue2 = lines2[counter]
myProps.setPropertyValue("Value", tempValue)
myProps.setPropertyValue("Value2", tempValue2)
log.info tempValue
log.info tempValue2
testRunner.runTestStepByName("updateBusinessTrip")
}

How to make it load values from same file separated by ";"? txt file would look like that:

Value1;Value2
Value1.1;Value2.1
Value1.2;Value2.2

Aucun commentaire:

Enregistrer un commentaire