import java.applet.Applet; import org.netbeans.jemmy.Test; import org.netbeans.jemmy.Scenario; import org.netbeans.jemmy.operators.ButtonOperator; import org.netbeans.jemmy.operators.ContainerOperator; import org.netbeans.jemmy.operators.LabelOperator; import org.netbeans.jemmy.operators.TextFieldOperator; //implements Scenario. public class MyTest implements Scenario { Applet applet; //applet is supposed to be found && passed here from //one of the test executor. public MyTest(Applet applet) { this.applet = applet; } //method executes test in a different thread public void startTest() { new Thread( new Runnable() { public void run() { System.exit(new Test(MyTest.this).startTest(null)); } }).start(); } //Scenario's runIt public int runIt(Object obj) { //create a ContainerOperator fpr applet ContainerOperator appOper = new ContainerOperator(applet); //push button new ButtonOperator(appOper, "button").push(); //check that button has been pushed new LabelOperator(appOper, "has been pushed"); //type text TextFieldOperator txtOper = new TextFieldOperator(appOper); txtOper.clearText(); txtOper.typeText("text has been typed"); return(0); } public String getDescription() { return(getClass().getName() + " test"); } }