Loading ...
Sorry, an error occurred while loading the content.

Re: [junit] Emulating JavaScript in HTTPUnit

Expand Messages
  • Alain Ravet
    We had the same problem, and found a simple solution in a web-based project : In a web page, there were many buttons in 1 form, that would, through javascript,
    Message 1 of 6 , Mar 1, 2002
    View Source
    • 0 Attachment
      We had the same problem, and found a simple solution in a web-based
      project :

      In a web page, there were many buttons in 1 form, that would, through
      javascript, call different servlets. The javascript functions would
      ignore the default - hardcoded - action of the form, unlike pure httpUnit.

      The buttons were :
      "Save", "Delete", "Reload"...
      The javascript functions were :
      "callSaveServlet()", "callDeleteServlet()", ..
      The target servlets were :
      SaveServlet, DeleteServlet, ReloadServlet


      Using Velocity (http://jakarta.apache.org/velocity/), the simplest way I
      found, was to have this hardcoded action linked to a Velocity variable
      "$actionTarget".
      =>
      Before clicking the "Save" button with httpUnit, I would just change,
      through Velocity, the value of $actionTarget to "SaveServlet".

      Though not the real thing, it was good enough for repetitive unit
      testing, as we had one "non-automated" test (read : "manual") test, that
      would have trapped typos related error.


      Using this trick, I could extensively test my javascript enabled
      web-app. with pure and simple httpUnit.

      It was good enough for enough for us.
      Could be for you.

      Alain Ravet
    • Vogel, Kent
      Interesting. We re using JSP instead of Velocity, but I suppose the same principal would apply.
      Message 2 of 6 , Mar 1, 2002
      View Source
      • 0 Attachment
        Interesting. We're using JSP instead of Velocity, but I suppose the same
        principal would apply.

        > -----Original Message-----
        > From: Alain Ravet [mailto:alain.ravet.list@...]
        > Sent: Friday, March 01, 2002 12:32 PM
        > To: junit@yahoogroups.com
        > Subject: Re: [junit] Emulating JavaScript in HTTPUnit
        >
        >
        > We had the same problem, and found a simple solution in a web-based
        > project :
        >
        > In a web page, there were many buttons in 1 form, that would, through
        > javascript, call different servlets. The javascript functions would
        > ignore the default - hardcoded - action of the form, unlike
        > pure httpUnit.
        >
        > The buttons were :
        > "Save", "Delete", "Reload"...
        > The javascript functions were :
        > "callSaveServlet()", "callDeleteServlet()", ..
        > The target servlets were :
        > SaveServlet, DeleteServlet, ReloadServlet
        >
        >
        > Using Velocity (http://jakarta.apache.org/velocity/), the
        > simplest way I
        > found, was to have this hardcoded action linked to a Velocity
        > variable
        > "$actionTarget".
        > =>
        > Before clicking the "Save" button with httpUnit, I would just change,
        > through Velocity, the value of $actionTarget to "SaveServlet".
        >
        > Though not the real thing, it was good enough for repetitive unit
        > testing, as we had one "non-automated" test (read : "manual")
        > test, that
        > would have trapped typos related error.
        >
        >
        > Using this trick, I could extensively test my javascript enabled
        > web-app. with pure and simple httpUnit.
        >
        > It was good enough for enough for us.
        > Could be for you.
        >
        > Alain Ravet
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        > ---------------------~-->
        > Tiny Wireless Camera under $80!
        > Order Now! FREE VCR Commander!
        > Click Here - Only 1 Day Left!
        > http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/NhFolB/TM
        > --------------------------------------------------------------
        > -------~->
        >
        > To unsubscribe from this group, send an email to:
        > junit-unsubscribe@yahoogroups.com
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.