Rob Dennett wrote:
Since that is the case, how do you affect the services of a page?
For example, page 1 of my app is a login page.  In order to get to
page 2, there needs to be a user in the database.  I can fill in the
username and password fields on page 1 and click submit using
HtmlUnit, but it doesn't take me to page 2 because there is no data
in the database.  I'd like to either get access to the database (I am
using an in-memory instance of HSQL for testing purposes) or give
page 1 a fake service which accepts the fake username and password
that HtmlUnit passes to it.  Is there anyway to do that, or am I
totally misusing HtmlUnit?

Create a TestLoginPageCaller which is itself an external page. What
it does is to do something like:

  void activateExternalPage() {
    Login login = (Login)cycle.getPage("Login");
    login.setUserAuthenticator(new UserAuthenticator() {
        void authenticate(String userName, String passwd) {
           //your fake implementation
        }
    });
    cycle.activate(login);
  }

--
Kent Tong, Msc, MCSE, SCJP, CCSA, Delphi Certified
Manager of IT Dept, CPTTM
Authorized training for Borland, Cisco, Microsoft, Oracle, RedFlag & RedHat

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to