Testing View Rendering

20 views
Skip to first unread message

André Faria

unread,
Sep 14, 2011, 9:28:33 AM9/14/11
to Scalate
Hello everybody,

In the rails community is very common to test view rendering in the
integration level, and even it the unit level.

In the Java Community, I don't see much concern about that.

I've found something about unit testing velocity views :
http://snippets.dzone.com/posts/show/1592

Do you guys use to do something like that?

Sometimes my team get bugs in production, because the change the
controller the view does not have test. We would like to be able to
test it without having to write acceptance tests for everything, cause
they are very expensive for us.

Thanks,
Regards,
André Faria

James Strachan

unread,
Sep 14, 2011, 10:00:38 AM9/14/11
to sca...@googlegroups.com
2011/9/14 André Faria <andre...@gmail.com>:

Great post!

So the first thing is you can compile all your templates as part of a
CI build as they are statically typed (for ssp, jade, scaml); so you
can catch templates breaking due to model/controller/API change -
which tends to be the most common cause of stuff breaking
http://scalate.fusesource.org/documentation/user-guide.html#precompiling_templates

In terms of integration testing; you may want to do that inside your
container (e.g. web connector/container + MVC layer or framework of
your choice + scalate).

We have a little integration test framework we tend to use to test
using scalate inside Jetty...
https://github.com/scalate/scalate/blob/master/samples/scalate-sample/src/test/scala/org/fusesource/scalate/sample/SampleTest.scala

scaladoc here:
http://scalate.fusesource.org/maven/1.5.2/scalate-test/scaladocs/index.html

e.g. here's the assertions...
http://scalate.fusesource.org/maven/1.5.2/scalate-test/scaladocs/org/fusesource/scalate/test/WebDriverMixin.html


Or you could try things like Selenium/WebDriver for something a little
more webbyish (which can test different web browsers too)

--
James
-------
FuseSource
Email: ja...@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/

Open Source Integration and Messaging

André Faria Gomes

unread,
Sep 14, 2011, 10:31:52 AM9/14/11
to sca...@googlegroups.com
Thanks very much James, We'll try to put your advices in practice, then I'll share the results.

Regards,
Reply all
Reply to author
Forward
0 new messages