Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

How do you unit test your Velocity pages?

I've started working with an additional client this morning and one of my first tasks is to figure out the best solution for 1) unit testing the UI and 2) unit testing Velocity templates. It's funny how the blogosphere makes life so much easier. Today was my first meeting with the client and they wanted to know if there was a way to test Velocity templates. Yesterday, I saw a headline in NetNewsWire about unit testing Velocity. I glossed over it b/c I didn't have any use for it. When they mentioned it today - I remembered it, searched on java.blogs and found JUnit Testing Velocity. Folks might think that reading blogs leads to reduced productivity - but I think it leads to more efficient productivity.

I think I'm going to implement something using the JUnit/Velocity stuff above and jWebUnit. jWebUnit will be used to test the WebWork actions and their interaction with the Velocity templates. Anyone had experience (good or bad) using this approach on their projects? Any other alternatives you've used to ensure error-free Velocity pages?

I like jWebUnit because you can easily switch locales and test against ResourceBundle keys for i18n. I don't think this is possible with Canoo's WebTest. The nice thing about Canoo's WebTest is they're migrating to HtmlUnit (rather than HttpUnit), which supposedly has a lot better JavaScript support. Both jWebUnit and WebTest currently use the Rhino js.jar - which throws exceptions for perfectly good JavaScript code.

BTW, anyone know why searching for "appfuse" on JavaBlogs causes a 500 error?

Posted in Java at Nov 10 2004, 09:16:57 AM MST 5 Comments
Comments:

BTW, do you know why searching for "appfuse" on raibledesigns.com causes an error?

Posted by Ville on November 10, 2004 at 11:37 AM MST #

Good point. It's a bug in my template that I haven't figured out a solution for. I'll change my search to point to the "sitewide" search which seems to work.

Posted by Matt Raible on November 10, 2004 at 11:41 AM MST #

We use HTMLUnit as a basis for our acceptance tests. We have a baseclass that provide functions that are used repeatedly and are reused in the actual tests. We did try jWebUnit as well, but then, this was a year ago, it was not really flexible enough. We call these tests Acceptance Tests, as they would ideally be written by the Customer talking XP-ish. As there are only the three of us developers all in all we write them ourselves however. The tests are organized such that we have a test per story, and the stories are grouped per iteration/release. We try to separate the unit tests from the acceptance tests due to the great difference it takes in running them. If the acceptance tests were included in the same test suite, that would lead to the tests being run less frequently. Instead they are run on separate build machine, one per target os - there are a bunch of not so funny things happening on Windows.

Posted by Marcus Ahnve on November 10, 2004 at 01:46 PM MST #

Check out the unit tests we have in WebWork for testing the templates for the UI tags. You don't need to go through a container when you're using Velocity.

Posted by Jason Carreira on November 11, 2004 at 12:38 PM MST #

How do you unit test your Velocity templates? Why, one template at a time. ;-) Ba dum bump.

Posted by Keller on November 11, 2004 at 12:39 PM MST #

Post a Comment:
  • HTML Syntax: Allowed