struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Unittest - catch 22
Date Sun, 18 Mar 2007 06:52:37 GMT

I have setup a local developer environment for Struts2 and clover to report on the unit tests.

When the unit tests are executed they are setup to only log at WARN level (
in core/test/resources folder). In clover there are some log output at DEBUG level that are
not tested and I changed the to include this line:

# set to lowest debug level to also execute debug code during unit testing to ensure it works

Now we have tests failing since some of the unit tests are using easymock or jmock and the
predictions are now screwed due a different log4j level.

What's the S2 developers point of view on this? Should we assume that debug logging just works
and thus run unit tests at current WARN level? 

The current unit tests are failing since we are debugging some more info at DEBUG level at
thus calls some methods that jmock did not expect. My own point is that the current unit tests
are correct and that in an ideal world jmock would not fail just because we log some debug
information. But it would be nice to run unit tests at TRACE level to run through all the
code as possible.

[surefire] Running org.apache.struts2.portlet.PortletRequestMapTest
[surefire] Tests run: 6, Failures: 5, Errors: 0, Time elapsed: 0,016 sec <<<<<<<<

org.jmock.core.DynamicMockError: testPut: no match found
Invoked: javax.portlet.PortletRequest.getParameterMap()
expected once: setAttribute( eq(<testAttribute>), eq(<testValue>) ), is void
expected once: getAttribute( eq(<testAttribute>) ), returns <testValue>

	at org.jmock.core.AbstractDynamicMock.mockInvocation(Unknown Source)
	at org.jmock.core.CoreMock.invoke(Unknown Source)
	at $Proxy34.getParameterMap(Unknown Source)
	at org.apache.struts2.portlet.PortletRequestMap.<init>(
	at org.apache.struts2.portlet.PortletRequestMapTest.testPut(
Posted via Jive Forums

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message