This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I've got a stripes/spring/jpa/jsp/hibernate/mysql stack web application. I'm looking to implement some sort of automated testing, but I'm really unsure of how to approach this.
I've had a look at JUnit as that seemed the natural choice, but how can I run tests on such simple code as below?
For example, one of my JSPs looks like this, is there anyway I can test to make sure the variables are correct? Say I rename some attributes on my domain class, I'd like a test to fail if I forget to go through my JSPs and rename attributes
Should I not be as concerned about testing? Testing is good practice, and so far I haven't done any, I really want to change this but could do with some advice
The two things would (necessarily) be tested completely differently. If you want to test the output of a JSP you really want to do integration testing, driving a browser, and so on. Testing the first method can really depend: do you want to test your full JPA stack (also integration testing), or do you want to test what persistClient itself is doing, which is do one behavior if there's no ID, or a different one if there is?
I think the problem that I have, is that I'm not sure on what I should be testing
At the moment my application is a simple CRUD application, and I can't find anywhere that would be suitable for automated testing. For example there is no need for me to test .persist()
Maybe I should only be testing my action and service layers?