Automated Tests in my life – part 5
Relieve a stress
A question… Is it familiar situation when you wrote a quality code according to
the requirements and then you were told that you did not understand the requirements?
Bad feeling, a? I made a good job and now am wrong!!!
As I figured out it happens to many people and happens a lot…
A real story from my own practice.
Once upon a time I had to write some logic for a table (logic was separated from UI –this helps to test UI logic automatically without viewing on screens all the time). The colors and numbers in table change, according to some logic. The behavior of the table was a requirement from customer. So I had to write some code for the logic in order to answer on the customer requirements.
First of all the tests that answer the questions were written – functions that can return specific values (I used TDD technique). After each test the code “for” the
test was implemented. When all finished and I ran all the tests that covered all scenario, all tests were green (passed), task was finished, tested integrated with GUI, the task was done.
Two month later… Customer side said there is a bug in color changing logic. They expected different behavior in some cases. Of course my boss asked me a simple question – why did it happened?
I really did not remember all the code I wrote couple of months before and all the logic behind it, but after finding the tests that covered this specific logic, with great self confidence I showed how they pass to bosses. Nothing broke, nothing changed!!!
It means that all the tests answered on requirements and all the code was written
exactly according to requirements. When bosses saw tests and green lights, indicating tests pass, they were happy. It was clear that code was ok, according to logic from customers. What was the reason of all this?
Customers changed the requirements a little bit; at the beginning they did not have a clear picture of all, so problem was not at our side. As you can see, I had my own advocate and for free.