Brackets in scripting in soapui.
- 2 years ago
Hi,
Would you mind giving a little more detail or at least a specific example?
When there are brackets, it typically indicates a method on a class. E.g. myObj,toString() where toString is a parameter-less method. You may also need to pass in parameters to a method. For example log.info() expects you to 'pass' in a message. E.g. log.info("Hello World")
Where there are square brackets, that typically indicates an element within an list, array, collection.
You tend to put a number inside the square brackets which says which row you're interested in. E.g.
var animal = animals[0]; // Gives the animal in the first (first because lists are zero-index based) row.
Typically, you'd actually put a variable inside the square brackets...
Note, the below is purely for illustration and probably won't be syntactically correct.
for (i = 0; i < animals.size; i++) {
var currentAnimal = animals[i]; // Get the animal at position i based on our loop.
log.info(currentAnimal);
}