Prompting for user input with the UISupport class
When developing extensions, plugins, and scripts, you may need to display alerts, prompts, and confirmations. The UISupport
class can help with this! It's a rather large class with a lot of capabilities in addition to those mentioned. In this recipe, we'll look at a few examples to get you started. It's quick and easy to use!
Getting ready
The UISupportExamplesProject
project containing the Groovy examples from this recipe can be found in the chapter 11
samples.
How to do it...
As a quick demonstration, we'll just use a Groovy TestStep
to run a few examples. The examples will also work in plugin extensions.
The first thing we need to do is import the class:
import com.eviware.soapui.support.UISupport
To display an info popup, enter and run:
UISupport.showInfoMessage("Hello from UISupport!")
To display a question prompt with default value and capture the answer as a String:
String answer = UISupport.prompt("Question","Title","default value")
For a prompt...