HtmlUnitPosted: August 15, 2007
Inspired through the news about the new HtmlUnit version (TheServerSide-News) I decided to give it a try to test some JSF application. One of the first things were some error-messages about redirection, as described in this HtmlUnit-FAQ-entry. Well I could not accept that… and some intense minutes of digging into some sourcecode… here is a possibility to turn off those error-messages:
In the setUp()-method, or under Junit 4 the setUpBeforeClass()-method, I added these two lines:
System.getProperties().put( "org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.getProperties().put( "org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient.HttpMethodDirector", "fatal");
And the error-messages are gone. The same things could be done in a config-file, but dealing here with unit-testing I prefer to do it directly in Java. The most difficult thing was determining the name of the second property.
more to follow…