Forum Discussion
- JKambliStaffHi,
You can add a DataSource test step, add excel file as DataSource and add a groovy script test step, add a loop.
So lets assume that you have a DataSource property "number" which you want to add in array. Create a test case property "main_array".
DataSource
Groovy Script test step
Data Source loop (DataSource > Groovy Script test step)
In the groovy script test step add,
if( context["array"] == null ) context["array"] = []
context["array"] << context.expand( '${DataSource#Number}' )
//log.info context["array"]
// Set the array in testcase property named main array
testRunner.testCase.setPropertyValue( "main_array", context["array"])
This should work!
Thanks,
Jeshtha- GarethNew Contributor
Hi,
I have the same problem but the solution proposed does not work.
I get this error when running the Groovy script:
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlTestCasePro.setPropertyValue() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [modelOptions, [W5]] Possible solutions: setPropertyValue(java.lang.String, java.lang.String), getPropertyValue(java.lang.String) error at line: 7
It seems the code is attempting to set a property with an array (java.util.ArrayList) but the method only works setting a string (java.lang.String). I have searched the forums for a solution to this i.e. setting a property with an array - but have not found it.
Can you please advise how to take a list of values (e.g. in Excel) and then convert that to an array (JSON in this case) to set in a Request.
- JKambliStaff
Convert the array to string since testCase properties can only save strings, you can reconvert it to array when you wish to reuse it.
Thanks
Related Content
- 6 years ago
- 3 years ago
- 6 years ago
- 12 years ago
- 5 years ago
Recent Discussions
- 22 days ago