2012/9/4 Dave Newton <[email protected]>:
> I think the coolest would be to have some BDD in there, like with easyb/etc.

I have no experiences with BDD/easyb, some example ?

> It can drive JWebUnit (IIRC, or HtmlUnit), can be run from Maven, and is
> easy to write.

Yeah, no needs to run a web browser and so on, but that's wrong :/

Anyway, I was able to add a simple integration test to Blank Webapp,
it looks like below, WDYT? Is it the right direction ?

public class HelloWorldIntegrationTest {

    public static final int PORT = 8090;

    @Before
    public void setUp() throws Exception {
        Server server = new Server(PORT);
        WebAppContext handler = new WebAppContext("src/main/webapp",
"/struts2-blank");
        server.setHandler(handler);
        server.start();

        JWebUnit.setBaseUrl("http://localhost:"; + PORT + "/struts2-blank/");
    }

    @Test
    public void testIndex() throws Exception {
        // when
        JWebUnit.beginAt("index.action");

        // then
        JWebUnit.assertResponseCode(200);
        JWebUnit.assertTitleEquals("Struts is up and running ...");
        JWebUnit.assertLinkPresentWithExactText("English");
        JWebUnit.assertLinkPresentWithExactText("Espanol");
    }

}


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to