This text may seem to re-invent the wheel. It was first published within company’s intranet to evangelize and tutor junior programists. That’s why :)
Testing is hard. Making it in an efficient way is even harder. Legions of experienced functional and technical people spent man-years on finding out the best approach and (IMHO) they didn’t come up with anything special - what we usually do is: create cycles, scenarios and scripts based on functional requirements, maintain them all during project life-time and execute scripts manually as needed. Usually the testers we provide are the gap-fillers - they know what to focus on, which part should be re-tested after particular functional changes, etc. That makes testing less automate and more dependable on people who perform them. So, if it works, why should we change it? What are the problems with the classic approach?
-
Usually test scripts are poorly categorized and grouped, so it’s not obvious what should be retested after changing part of given module.
-
Test scripts are executed manually and (in theory) consecutive changes in particular module should be followed by series of re-testing.
-
Test scripts are maintained as long as main project is up. As soon as basic maintenance starts, every regression test appears to be a problem.
-
We perform testing on the level of UI only, so if we want to test some “guts” we usually need full End-to-End testing.
-
Efficient test data management requires a lot of cross-system knowledge and gets very complex.
-
Sometimes testing even small and simple routines requires running heavy processing (like end-of-day) and that doesn’t help in performing quick re-tests
The one who follows what’s hot and trendy should immediately answer - go unit testing! It’s seems an obvious choice, but we usually don’t do it. Why? Because it’s not in the traditional approach?
Project managers don’t believe in unit tests due to various reasons:
-
Developers don’t know how to make really useful unit tests, so they usually get bored very quickly and morale drops rapidly (together with programming efficiency).
-
"Hey we’re paid for delivering, so let’s focus on coding and we’ll fix what’s to be fixed later!"
-
Every test needs to load plenty of data and wipe database afterwards, so running tests takes a lot of time
-
"We had to overhaul this accounting module, so we’d need to re-write all unit tests and we don’t have time for that!"
-
"Sure, they write tests, but as I’m not that much into code, how should I know if running them is enough to prove code as correct? I have to maintain and run scripts anyway, so unit tests are redundant!"
-
If you can’t write tests efficiently, it’s probably because you have a faulty application architecture (95%).
-
If you start coding with creating interfaces (functional ones) and composing tests on the top of them, you can easily validate your developer’s work without digging into the details. It’s extremely convenient and useful.
-
If your developers don’t get it that tests are here to save their … bottoms, they surely do not know how to make the tests.
-
Tests are useless without proper data approach and if you do it right, you don’t have to care about end-to-end on the level of unit tests (try mocking, I’ll write more about that below).
-
Kent Beck’s book about TDD: (http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530/ref=sr_1_1?ie=UTF8&qid=1324993911&sr=8-1)
-
Website of Typemock - those people are among the best unit testing experts worldwide (http://www.typemock.com/)
-
Book written by Typemock’s chief architect - Roy Osherove (http://www.amazon.com/Art-Unit-Testing-Examples-Net/dp/1933988274/ref=pd_sim_b_4)