The road so far….

April 7, 2013

Junit Recepies : Having common Setup and Teardown

Filed under: Agile, java — Tags: , — Rahul Sharma @ 7:56 pm

The other day I was refactoring one of our apis. We were removing some of the columns as they were not required. I believe in this exercise dropping the column was the most easy part. After that I removed the corresponding fields from the associated ORM and it was fine for the business related code.  But !! the big one, was my code was not compilable, as the object was being used in a lot of tests and thus my project was all painted RED.

While I was fixing all the required tests I realized most of the tests were on similar lines. We were pushing some data in tests, creating some required resources and then destroying them after the tests were done. Now we have blatantly copied the stuff in every testcase  with total disregard to the DRY principle. (more…)

Advertisements