views:

37

answers:

2

I am having a lot of headaches maintaining a website right now. Most often things would end up breaking after a couple of updates. This website was started by two developers in our team and then passed on to me. I was wondering if it would be alright to go with unit testing and acceptance testing considering that I'm halfway through the project.

Would it take a long time to write tests now? Will it be practical or are there other testing methods for this?

+3  A: 

It's never too soon to introduce testing and the sooner you do it the sooner you will start finding the bugs.

I'd start with testing from two different view points. Firstly if you have some fairly standalone java classes being used for things like business logic and data processing, I'd start create JUnit tests for them ti winkle out internal code issues.

Secondly I'd be looking to create tests for the use cases specified by the business. These would most likely be done in something like Selenium because you want the test to follow the interactions with the web site as specified by the use cases. Leave the nitty gritty to the JUnit tests behind the scenes. These are the high level confirmations of functionality.

All of this will take time and it's unlikely that management will allow you to do nothing but testing for a couple or weeks or more. Instead the mostly likely way to handle it is to do it as you go. Pad out your time quotes for fixes and new features to allow for writing the tests. Remember that writing tests can take 50% or more of the time, especially when you are starting to fill them out. The time will back off a bit once you have a wide range of suites, but even then some tests are harder to write than the code. But they are worth it.

Derek Clarkson
Also, don't even TRY to test everything; instead, build up your test suite as you go. Focus on existing bugs (write a test that fails, then make the test pass) and on sections of the code you are suspicious of. Okay, EXTRA suspicious of.
Rodney Gitzel
A: 

I agree with Derek. Never too late. Create the framework for your tests. Probably one project for integration tests, one for unit tests. As you are late in the day, concentrate on integration tests that'll allow you to sanity test the solution prior to deployments. You will get fast benefit from that. As bugs are raised, this will also give you the infrastructure to reproduce them more easily and create fixes quicker.

Nick Ryan