Contributions
Reading DataSource Items in a Script following a JSON
Hi guys, I have a REST Request that is a JSON. I am using a datasource to input various values into the request. This is in the format as so - ${DataSource#Postcode} If I look in the raw request message, this is working fine and populating from the DataSource. However when I try and reference the request message in a property script - def jsonrequest = testRunner.getTestCase().getTestStepByName("RESTRequest").getHttpRequest().getRequestContent() I get this error - groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object The current character read is '$' with an int value of 36 Unable to determine the current character, it is not a string, number, array, or object line number 1 index number 4333 It appears that it is not referencing the request containing the values from the datasource, but rather the raw text. How can I fix this? I've used this method successfully in XMLs before.443Views0likes1CommentMulti Thread a Loop in a Groovy Script that calls another test case
Hello, I have a project set up with one test suite, and two test cases within them. One test case contains a number of test steps that contain various assertions based on the response message from a REST response and what it should contain. The request message in this test case has several variables which are set by calling a properties table. Separately, the second test case contains a Groovy script, which is designed to run through the first test case a number of times. In this script I have various lists of data. The script then cycles through each list, and amends the variables in the first testcases properties, each amendment being a separate run of the first testcase. This is all done within a loop. The problem is that this means each test is run sequentially which is not efficient. Is there a better way to do this? The loop is set up like so - for(int NumCycle = 0;NumCycle<2;NumCycle++){ (Ifs that amends some variables) for (X in Variables){ runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), true); (then all my bits to log out the results of each assertion on each step) runner.waitUntilFinished()}} So when I press play on the Groovy script, I'm able to loop through twice and amend the variables to what I need them to be for each run. This all works, but is slow because its one request/response per loop. Anyway to resolve? Thanks in advance!1.6KViews0likes1Comment