runner.setDriver(driver);
runner.setHtmlResultDir(new File(root, "html").getPath());
runner.setScreenshotAllDir(new File(root, "img").getPath());
CommandFactory cf = runner.getCommandFactory();
String s1name = "suite1";
TestSuite s1 = Binder.newTestSuite(filename(root, s1name), s1name);
String s2name = "suite2";
TestSuite s2 = Binder.newTestSuite(filename(root, s2name), s2name);
String c1name = "case1";
TestCase c1 = Binder.newTestCase(filename(root, c1name), c1name, "http://localhost");
c1.addCommand(cf, "store", "3", "index");
c1.addCommand(cf, "while", "${index} > 0");
c1.addCommand(cf, "open", "/form.html");
c1.addCommand(cf, "storeEval", "${index} - 1", "index");
c1.addCommand(cf, "endWhile");
String c2name = "case2";
TestCase c2 = Binder.newTestCase(filename(root, c2name), c2name, "http://localhost");
c2.addCommand(cf, "open", "/form2.html");
s2.addSelenese(c2);
s1.addSelenese(c1);
s1.addSelenese(s2);
runner.execute(s1);
runner.finish();
}