10

We're developing a data heavy modular web application stack with java but have little expert knowledge concerning tests. What we currently do is using JUnit to run a mixture of unit tests and functional tests. I described the problem in more detail here.

Now we decided to set up standards early on, on how to test our modules and applications so we'll need to read up on the principles and best practices of testing in general and in the java spring environment in particular.

What I'd like to have covered are the definitions, use cases and reasoning behind the different kinds of tests from unit test to scenario test, or as google calls them: small, medium, large tests. Like I said, we're developing a data heavy web application.

I'd like to be able to deduce from the book how necessary and how useful each testing stage is on which corresponding level of our application (core, database access, security module, entity managers, web-model, web-controller, web-view)

It would be nice if the examples in the book are directly applicable to our application stack. We're using spring, JPA(hibernate), JSF, spring security. For testing so far we're using the basic Junit and some powermock. So JBOSS, Seam or Java Enterprise books are not so usefull.

If there are great articles on the web that paint a clear picture and really do help, feel free to share those as well (I can use google, SO and wiki myself, so please only articles that you actually read and deem very helpful), but a book would be nice so I can read up from the basics and don't have to piece it all together from various articles and questions.

Thanks!

Edit - books we ordered

Just started reading Growing object oriented software guided by tests and I already like it a lot. Not for the total beginner but shows how to develop test driven with agile techniques. Really cleans up old ways of thinking about software development.

We also ordered xUnit Test Patterns: Refactoring Test Code to get an idea of how to best unit test the different areas in our application stack. Got this recomendation twice so I'm hopeful it will be helpful.

Community
  • 1
  • 1
Pete
  • 10,720
  • 25
  • 94
  • 139

3 Answers3

6

Take a look at the resources under this answer. I highly recommend the first three books, the first two directly address your "levels" questions. The first is more focused on specific tools, while the second is more conceptual.

Community
  • 1
  • 1
cwash
  • 4,185
  • 5
  • 43
  • 53
4

Book recommendation: JUnit Recipes - Practical Methods for Programmer Testing

Tools: JUnit + Hamcrest + Mockito

And you're using Spring, check out spring-test, it offers some great facilites, Spring Testing

isah
  • 5,221
  • 3
  • 26
  • 36
  • 1
    Thank's for the recomendation. Looks like it could be very useful. Have you read it? Does it address all issues that I mentioned? Looks like it coveres a lot of unit testing but does it adress the higher levels as well and explain why and when to use it? Or should I combine this book with more general literature on testing? – Pete Jan 26 '12 at 16:28
  • 1
    The book is a little 'old'. I'm in the process myself but so far I like it. I use to come back to it from time to time and I appreciate it more on the general concepts. Me and my team use Spring and Hibernate too, and Spring's documentation was more useful in this case. You won't find a book which addresses your tools exactly, but you can combine by using other books and each tool's documentation and come up with the solutions. – isah Jan 26 '12 at 16:50
0

Hate to give you a snippet of an answer (as you've said you want a solid guide) but I can't really recomment any books. Best practices should involve TDD though. It's much bandied about but it aids regression and eases the mind when those ad-hoc quick requirement changes come in (when you know you've a solid codebase).

Additionally, you may want to see if BDD (Bean Driven Development) is right for you. I mention this as you may not stumble upon it in your searching. Advantages include translation from English to test cases to prove test scenarios in terms of goals. This allows you, your testers and even your product owner to easily correlate the tests with your requirements:

wmorrison365
  • 5,995
  • 2
  • 27
  • 40