Example #1
0
  public WebResponse loginForm(String username, String password) throws Exception {
    WebConversation conversation = new WebConversation();
    HttpUnitOptions.setScriptingEnabled(false);
    HttpUnitOptions.setExceptionsThrownOnScriptError(false);
    WebRequest request = new GetMethodWebRequest("http://localhost:8084/LeaveApp/index.jsp");
    WebResponse response = conversation.getResponse(request);
    WebForm loginform = response.getForms()[0];
    loginform.setParameter("username", username);
    loginform.setParameter("password", password);
    request = loginform.getRequest("submitbutton");
    response = conversation.getResponse(request);

    return response;
  }
Example #2
0
  public void testWSDL() throws Exception {
    WebConversation conversation = new WebConversation();
    String destination = testProps.getProperty("destination");
    if (destination != null && destination.length() > 0) {
      WebRequest request = new GetMethodWebRequest(destination + "?WSDL");

      WebResponse response = conversation.getResponse(request);

      int i = response.getContentLength();
      InputSource is = new InputSource(response.getInputStream());

      Document doc = builder.parse(is);

      doc.getDocumentElement();
      System.out.println("My test");
    }
  }