Wednesday 12 January 2011

Diamonds are forever

I never really appreciated the value of a diamond until I worked on this project with a client who grades and inscribes diamonds.
I was pulled into this project to modify their existing reporting system around invoicing. They also wanted to change their printers to a better brand. These printers were specially designed to print only on chip based cards.
This project was really exciting because it was my first non web based project. It was a man - machine - interface based application.
The grading and inscription process of a diamond is a long and tedious one with several steps involved in it. At each step there is an instrument (machine) which plays its role. Each of these instruments are connected to a computer which runs the client application. It was fun to interact with the instruments through this application and observe their behaviour. The client stake holders were more than helpful and patient enough in making us understand the domain.
There were a different set of problems that I had to tackle in this project.
The application consisted of a standalone software on each of the computers, a small web based admin page and reports. It was challenging to write automation tests for the standalone application running on different computers.
So tests were written around the grading and inscription process using a mock up application. At the time I walked into the project, these tests were broken. I suggested the team that we should be fixing those tests and running them on a separate build because of the length of time they took to run.
There were also massive amounts of reports which were being manually tested each time a release was being made. These reports were being generated in two steps; first a stored procedure was being called and temporary tables being generated, second the report generator would use these tables and make necessary calculations to show the correct figures on the report. I identified that there were no tests around any of these areas. I also showed them that the existing reports had several defects in them which they were unaware of and could have been avoided if they had some test coverage around them. I suggested the team that we should at the bare minimum write tests around the stored procedures so that we at least have a first level of safety net for the reports. I convinced the business that this would take some additional time in delivering their functionality but it is going to be good for the future of the project.
The existing continuous integration build was taking more than forty five minutes with little tests running on it. We found that we needed a virtual machine with better configuration to keep the build running quicker.
The web based admin pages too did not have any kind of automation tests. I initially suggested we use watiN as the code was in .Net, but the business came back saying that they would be happy with selenium because of their familiarity with it. So we researched and finally wrote the web based tests in selenium using .Net.

The other side of the story was the printer. The client got in a new brand of printer for printing their certificate cards for the diamonds. A certificate card which also has a chip full of information about the diamond in it is given to the customer on purchase of a diamond to confirm the validity. So the look and feel of the card was one of the most important factors. The particulars on the card being printed with the new printer had to look the same was as before. The first issue that we faced was that an image was being smudged. I tried playing around with the printer's heat settings, writing speed settings, different images etc. But none of that worked. After a couple of weeks of trials and trying to contact the printer guys, they sent a file which would change the firmware settings of the printer. And finally the image started looking better. But that had a side effect which meant I was unable to scan the barcode on the card anymore. It was a bit frustrating but enjoyed the different kind of challenges that I was faced in this project.