jaroslav@534: package ${package}; jaroslav@534: jaroslav@534: import org.apidesign.bck2brwsr.htmlpage.api.OnEvent; jaroslav@534: import org.apidesign.bck2brwsr.vmtest.BrwsrTest; jaroslav@534: import org.apidesign.bck2brwsr.vmtest.HtmlFragment; jaroslav@534: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@534: import org.testng.annotations.Factory; jaroslav@534: jaroslav@534: /** Sometimes it is useful to run tests inside of the real browser. jaroslav@534: * To do that just annotate your method with {@link org.apidesign.bck2brwsr.vmtest.BrwsrTest} jaroslav@534: * and that is it. If your code references elements on the HTML page, jaroslav@534: * you can pass in an {@link org.apidesign.bck2brwsr.vmtest.HtmlFragment} which jaroslav@534: * will be made available on the page before your test starts. jaroslav@534: * jaroslav@534: * @author Jaroslav Tulach jaroslav@534: */ jaroslav@534: public class IntegrationTest { jaroslav@534: jaroslav@534: /** Write to testing code here. Use assert (but not TestNG's jaroslav@534: * Assert, as TestNG is not compiled with target 1.6 yet). jaroslav@534: */ jaroslav@534: @HtmlFragment( jaroslav@534: "

Loading Bck2Brwsr's Hello World...

\n" + jaroslav@534: "Your name: \n" + jaroslav@534: "\n" + jaroslav@534: "

\n" + jaroslav@534: " \n" + jaroslav@534: "

\n" jaroslav@534: ) jaroslav@534: @BrwsrTest jaroslav@534: public void modifyValueAssertChangeInModel() { jaroslav@534: Index m = new Index(); jaroslav@534: m.setName("Joe Hacker"); jaroslav@534: m.applyBindings(); jaroslav@534: assert "Joe Hacker".equals(m.INPUT.getValue()) : "Value is really Joe Hacker: " + m.INPUT.getValue(); jaroslav@534: m.INPUT.setValue("Happy Joe"); jaroslav@534: m.triggerEvent(m.INPUT, OnEvent.CHANGE); jaroslav@534: assert "Happy Joe".equals(m.getName()) : "Name property updated to Happy Joe: " + m.getName(); jaroslav@534: } jaroslav@534: jaroslav@534: @Factory jaroslav@534: public static Object[] create() { jaroslav@534: return VMTest.create(IntegrationTest.class); jaroslav@534: } jaroslav@534: jaroslav@534: }