hammer
14 years agoOccasional Contributor
Groovy Script does not work
Hi,
I'm trying to write a small UI for a ID/Password Input. I've got 2 textareas and one Button. When you Click the Button, the Values of the textareas should be written in my TestSuite-Properties. What does not work is my function "write". It seems like it never gets executed, no matter what Operations i put in. I tried a few ways to make my Button b ActionPerfomed, none of it worked.
Anyone got a clue?
Thanks a lot!
hammer
I'm trying to write a small UI for a ID/Password Input. I've got 2 textareas and one Button. When you Click the Button, the Values of the textareas should be written in my TestSuite-Properties. What does not work is my function "write". It seems like it never gets executed, no matter what Operations i put in. I tried a few ways to make my Button b ActionPerfomed, none of it worked.
Anyone got a clue?
Thanks a lot!
hammer
import groovy.swing.SwingBuilder
import java.awt.GridLayout
import javax.swing.JFrame
SwingBuilder swing = new SwingBuilder()
def write(event) {
testRunner.testCase.testSuite.setPropertyValue("ID",textID.getText())
testRunner.testCase.testSuite.setPropertyValue("PW",textPW.getText());
}
f = swing.frame(pack: true, show: true) {
panel(layout: gridLayout(cols: 0, rows: 3)) {
textID = textArea(text:"ID");
textPW = textArea(text:"Passwort");
b = button(text:"OK",actionPerformed:this.&write);
}
}