1

I am working in soapUI. I need to define Array in Groovy in soapUI groovy script.

Could you please help me

2
  • Please provide your example code here. This makes it easier. Commented Jan 24, 2012 at 9:01
  • Do you mean a Groovy Array, or a soap-enc:array ?
    – Grooveek
    Commented Jan 24, 2012 at 9:40

2 Answers 2

4
// Define the array
def MAX_SIZE = 4
def myArray = new Object[MAX_SIZE]

// Fill the array
myArray[0] = "This"
myArray[1] = "is"
myArray[2] = "my"
myArray[3] = "array."

// Print content of the array
myArray.each { log.info(it) }
1
  • Very nice and short way of printing an array Commented Feb 13, 2018 at 4:06
0

See here, for example: http://groovy.codehaus.org/JN1025-Arrays

2
  • But the following statement is giving errors by defining array, Pls help - def a= new Object[4]
    – ABCDEFG
    Commented Jan 23, 2012 at 13:25
  • What is the error message? Have a look at the soapUI error log
    – Sebi
    Commented Jan 23, 2012 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.