struts-dev mailing list archives

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

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 (log4j.properties
in core/test/resources folder). In clover there are some log output at DEBUG level that are
not tested and I changed the log4j.properties to include this line:

# set to lowest debug level to also execute debug code during unit testing to ensure it works
also
log4j.logger.org.apache.struts2=TRACE

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 <<<<<<<<
FAILURE !!

org.jmock.core.DynamicMockError: testPut: no match found
Invoked: javax.portlet.PortletRequest.getParameterMap()
Allowed:
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>(PortletRequestMap.java:54)
	at org.apache.struts2.portlet.PortletRequestMapTest.testPut(PortletRequestMapTest.java:64)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=71345&messageID=133427#133427


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message