Yeah, I'm not sure there's a great way around this aside from a more black-box functional approach, but even that might not be getting as fine-grained as some of these tests need to be. With greater test coverage, I think it could be replaced, however.<br>
<br>~Lincoln<br><br><div class="gmail_quote">On Mon, Jun 11, 2012 at 10:25 PM, Richard Kennard <span dir="ltr"><<a href="mailto:richard@kennardconsulting.com" target="_blank">richard@kennardconsulting.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+1 for this.<br>
<br>
However note there are different levels of tests. Classes like FacesScaffoldScenarioTest are only meant to test very small, very specific things. Basically<br>
regression testing. Classes like FacesScaffoldWeatherTest are also small and specific.<br>
<br>
The real testing is done using Arquillian (like FacesScaffoldPetClinicClient and FacesScaffoldShoppingClient). Because whilst your point about 'if you<br>
place a line break in a generated XHTML... it breaks the whole test' is very valid, even with XmlUnit you are vulnerable to 'if you place an extra XML<br>
element in a generated XHTML... it breaks the whole test'.<br>
<br>
Testing through Arquillian is the only way to be really sure the generated app actually works, IMHO. Because you are testing it the way the user would.<br>
<br>
However, definitely +1 for using XmlUnit, as far as that goes.<br>
<br>
Regards,<br>
<br>
Richard.<br>
<div class="HOEnZb"><div class="h5"><br>
On 12/06/2012 12:09 PM, George Gastaldi wrote:<br>
> Hello all,<br>
><br>
> I noticed that most of our scaffold unit tests are kinda hard to<br>
> maintain. specially because they compare XHTML as strings, instead of<br>
> the structure as a whole.<br>
> This implies that if you place a line break in a generated XHTML for<br>
> example, it breaks the whole test as well.<br>
> What about if we refactor these tests to use XmlUnit instead ?<br>
> (<a href="http://xmlunit.sourceforge.net/" target="_blank">http://xmlunit.sourceforge.net/</a>)<br>
> This way we could compare the structure without the ugly plain string<br>
> comparison, WDYT ?<br>
><br>
><br>
> Regards,,<br>
> George Gastaldi<br>
> _______________________________________________<br>
> forge-dev mailing list<br>
> <a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
><br>
><br>
<br>
_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>"Simpler is better."<br>