"Control time" for deterministic AJAX web testing with HTMLUnit


News: "Control time" for deterministic AJAX web testing with HTMLUnit

  1. AJAX web applications are more complicate to test in an automated way than "classic old web apps": tests often have to perform additional actions to ensure a deterministic test execution. Marc Guillemot (lead developer of the Open source projects HtmlUnit and Canoo WebTest) presents in his blog a feature of the upcoming HtmlUnit release: the possibility to re-synchronize AJAX calls that should run asynchronously. We can imagine that this is only a first step and that this will evolve in the future to allow a very fine grained control of the asynchronous calls' execution. This would give the possibility to precisely reproduce race conditions that can lead to deadlocks on the server side what is very difficult with current web testing tools.

    Threaded Messages (3)

  2. JSF & AJAX4JSF[ Go to top ]

    very good work. will this work with JSF and Ajax4jsf?
  3. Re: JSF & AJAX4JSF[ Go to top ]

    very good work. will this work with JSF and Ajax4jsf?
    Ibrahim, I just added Ajax4jsf support to JSFUnit (http://www.jsfunit.org). JSFUnit is a new unit testing tool that runs in-container and allows access to JSF context objects and managed beans without needing mocks. The tests are written in regular JUnit, with a little help from Apache Cactus and HTTPUnit. JSFUnit has not been released yet, but there are instructions to checkout and build. If you do, you will find an sample app that tests three of the standard ajax4jsf demos. For JSFUnit, I've actually taken a third approach not mentioned in Marc's blog. Because JSF AJAX component libraries are pretty well-defined, it is possible to create an API that knows how to send AJAX calls at the HTTP level with no javascript at all. To re-sync the client, we just do the JSF equivalent of a page refresh. This technique is not really meant for testing client-side AJAX. It is more appropriate for testing server-side state changes that result from the AJAX calls. And JSF (server side) state is mostly what JSFUnit is about. Like Marc, I'm struggling with this question of how best to test AJAX apps. If his methods turn out to be good I may replace HTTPUnit with HTMLUnit or even with WebTest. Then you would have the best of both worlds testing client-side AJAX and server-side JSF all in the same test. Stan Silvert http://www.jsfunit.org
  4. Any ideas on how this is implemented? Is it javascript modifying itself (i.e. changing the normal ajax call) at runtime? Paul