Forum Discussion

HHaynes's avatar
HHaynes
Contributor
13 years ago

beta 2 not populating dependencies into agents

I sent an email to support about this - but thought I'd echo it here. I have a simple test that uses a Groovy script to call into an XML file to find a data element at random and then pass it into a test case-level property that is then expanded by the RESTful call into the service I'm testing. This is a basic cache-busting strategy.

When running the test locally in loadUI (on the controller) no problem. But when sending the VU scenario out to the agents, it all goes awry. As it turns out - the XML file that is used for retrieving the data element is NOT pushed out to the agents. I know this because when I put the file directly in the /.loadUI/fileStorage folder on the agents SUDDENLY the tests started working in distributed mode.

So - there ya go - that's my contribution to this beta. :-) You're welcome. (two working days of my life I'll never get back)

// standard context call
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

// general threadid set for logging - should be in every script
def threadId = Thread.currentThread().getId() as String

// set the project path
def projectPath = groovyUtils.projectPath

//Define a file pointer for groovy to handle the file operations.
def File inputFile = new File(projectPath + "/SOLR_output.xml")

if(!inputFile.exists())
{
testRunner.fail("Input File Not Found.")
}

else
{
//Read and parse XML file and store it into a variable
def InputXML = new XmlParser().parse(inputFile)

//get number of Events from a single element in the SOLR result
def numberOfEventsArray = InputXML.result.@numFound

def numberOfEvents = numberOfEventsArray.get(0) as Integer

// generate a randomized value based on the number of events
def randomEvent = (int)Math.random() * (numberOfEvents.value)

// retrieve the EventID of the randomly selected value
def selectedEvent = InputXML.result.doc[randomEvent].str.text()

// log the values retrieved to the console
log.info "[${threadId}] Event [${randomEvent}] ID [${selectedEvent}]"
testRunner.testCase.setPropertyValue( "EventId", selectedEvent )
// return selectedEvent
}