Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Excerpt
hiddentrue

How to achieve cleaner code and compile-time type-safety for your tests, probably saving 60% of your time


If you use Test Driven Development in Wicket, the first approach is often to use component's path names (e.g., page:panel:form:component) to test them. This is bearable at first, but as your pages get more and more complicated and have deeper hierarhices, you will find yourself spending a whole lot of time debugging typos and misconceptions (in my opinnion: you would waste 60% of your time doing this). The solution is: make your component hierarcy type-safe so that you can GET all of your components when testing:

...

  1. Compile-time type-safety
  2. By not hardcoding the runtime component paths into the tests, you can make your tests truly modular!
  3. You save 60% of your time (the time you would have wasted banging your head to the wall of wrong paths and components)
  4. The code is cleaner and nicer, easier to maintain
  5. The test-code is easier to read and makes much more sense as a spec