TestNG Example"
From Documentation
Line 39: | Line 39: | ||
</source> | </source> | ||
− | * It has little difference with | + | * It has little difference with JUnit test case. You only need to change <tt> @After </tt> to <tt> @AfterMethod </tt>. |
{{ZATSEssentialsPageFooter}} | {{ZATSEssentialsPageFooter}} |
Revision as of 03:24, 15 May 2012
To run a TestNG test case, please refer to Run TestNG.
public class HelloTestNg {
@BeforeClass
public static void init() {
Zats.init("./src/main/webapp");
}
@AfterClass
public static void end() {
Zats.end();
}
@AfterMethod
public void after() {
Zats.cleanup();
}
@Test
public void test() {
DesktopAgent desktop = Zats.newClient().connect("/hello.zul");
ComponentAgent button = desktop.query("button");
ComponentAgent label = desktop.query("label");
//button.as(ClickAgent.class).click();
button.click();
Assert.assertEquals("Hello Mimic", label.as(Label.class).getValue());
}
}
- It has little difference with JUnit test case. You only need to change @After to @AfterMethod .