I recently realized that our few cactus tests for displaytag simply didn't test anything...
There were a couple of "small" errors which prevented the tests to work:
- tag lifecycle assertions work only if called before the tagLifeCycle.invoke() method call (assertion after invoke(), like the ones in our tests, are never evaluated)
- the endXXX method names in our source were wrong: the end method for testAsXml has to be called endAsXml, not endTestAsXml as previously was in our code.
I've now fixed existing tests and added a couple more, but I'm getting crazy in making tests working...
anybody can help in understanding what is wrong there???
Actually the MediaTest test case doesn't work for 2 reasons:
- tag body seems always to be evaluated only once, so
this.columnOneLifecycle.expectBodyEvaluated(2);
fails. This happens also if the table source is a list with 2 values. In debugging the WebResponse text you strangely get a table with _2_ rows, but the second one is always empty.
- in MediaTest.testAsHtml() you have a different behaviour than the one you get in a jsp page. That is, a column with "xml" media always gets evaluated also for an html output. Note that testAsXml(), instead, works properly.
Any cactus guru out there?
fabrizio