Sylvain Wallez wrote:
Daniel Fagerstrom wrote:
Sylvain Wallez wrote:
Upayavira wrote:
Or unit/functional. That's actually the distinction isn't it?
Yep. That definitely sounds better.
But after more thinking I not sure we actually _need_ to make the distinction: what about having HtmlUnitTestCase create upon first use an embedded Jetty running Cocoon? This way we don't need to run it separately and the process can be completely automated.
The only problem may be to find an available port (8888 may not be always available) but it's fairly easy to find one before starting the servlet engine on that port.
Thoughts?
It doesn't solve the problem at hand, but it is possible to do functional testing of Cocoon without servlet. I have started to build some functionallity for that, that I'm using during VPC development. See src/test/org/apache/cocoon/SitemapTestCase.java and examples under generation.
This far I'm using the MockEnvironment, but it needs to be developed for making it usable in more cases.
As Cocoon is supposed to be environment independent I think it is better to do functional testing without servlets. It also simplifies testing to not have to start a servlet.
I had this idea also for "intermediate-level" functional tests, but HtmlUnit seems to be intimately tied to an HTTP stack, and not using it would mean rewriting all of its nice features.
Maybe we can work with the HtmlUnit folks so that they use an abstract request/response API...
Doesn't sound that realistic, it would give them higher complexity without any obvious gains.
The WebConnection (http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/WebConnection.html) that takes care of the communication with the http server is abstracted in HtmlUnit (it i set in WebClient.setWebConnection). We could write an own implementation that just calls the Cocoon processor. A problem with that approach is that the WebConnection class is marked "internal only", so it is probably not a stable API.
For development of VPCs, I have found "intermediate" level testing rather productive, even if it have taken some time to get the sitemap test case working. For development of real blocks I also think it is more or less necessary to have intermedia level testing for being able to control and test the setup in detail.
/Daniel
