Abdul Hfuda
Abdul Hfuda

Reputation: 1503

SOAPUI Groovy Script calls to Command Line

I would like to run something like

ipconfig /all | find "IPv4"

that fetches the IP addresses for all the interfaces I'm connected to. This is straight forward in pure Java or C#, and they even have a managed API for this. I could run a 'command line' command or access managed objects to fetch the IP address of the particular interface I'm looking for.

I have SOAPUI Pro and am aware the API is here, but I cant find out how do either make a command line call and fetch the result- nor a direct way to get the IP addresses with that API.

Ultimately I want to store the runtime IP address in a project property.

Upvotes: 1

Views: 4170

Answers (1)

Per Åkerberg
Per Åkerberg

Reputation: 354

This script runs the ipconfig /all command and gets the result into a variable. But the parsing to get the IP remains to be done. Currently the Groovy step will return the entire ipconfig result.

def result = "ipconfig /all".execute().text

//Do stuff with the result, probably RegEx your way to the IpAdress

return result;

Upvotes: 4

Related Questions