My experience:
- Wrote 75,000 lines, mission critical applications.
- From the day we pushed this program to live production, it has done what it means with reliable reliability on the breed.
Disclaimer: I programmed since childhood, so I am well versed in my work, but even I was surprised by the dramatic effect of several simple testing rules so that the application runs as reliably as the top end of Mercedes.
Testing form that worked for me:
- I did not do what some practitioners recommended, namely, "test first and then code." Rather, I took an approach to integrating as many tests as possible into the project, as I thought, before or after the actual code. For some methods, it was easier to write a method first, then tests. For other methods, it was easier to write tests first, then the method.
- I did not use the unit testing framework, but I integrated the tests into the program itself, as described in the remaining paragraphs. The only base I used was a third-party logging structure for any warnings and errors generated. I will not call the commercial that I used to keep this article neutral, and any free or commercial journal structure will do. I recommend any logging structure that allows you to view the logbook and then filter by some criteria, as it is very useful when viewing large logs for any suspicious activity.
- Class level testing was used: each class had a method that checked all other methods in the class. Some methods had a "sister" method, which was responsible for running tests using the specified method.
- Application -level testing was used: a lot of unit tests were written to pump real data into the program, and then check that the returned data was as expected (usually it was just a border check).
- Linear testing used : every time I knew the expected range of values inside a variable or array, I would write a silent warning if the data fell outside this range. In other words, I had unit testing integrated into the code structure itself. These tests could be disabled in Release mode, but I found that it did not greatly affect the speed of the final application, so I just left them.
From the whole test that I added, I found that linear level testing had the greatest positive impact on the reliability of the application as a whole. Surprisingly, a simple rule, such as “log the silent warning message, if the contents of the variable is not what you expect,” can have such a profound effect on the reliability of the application as a whole.
The best part about this approach is that it actually shortened the development cycle. Of course, there were many errors and warnings recorded at an early stage, but once they were fixed, the end result was surprisingly reliable. This approach made the program more robust for change and refactoring. I ignored the number of times that I changed what, in my opinion, was insignificant, which caused a warning that allowed me to correct a mistake that could lead it into production. Almost eliminated the usual phase of post-production costs of finding hard-to-reach errors. This was extremely important since it was a critical application that put at stake if it went wrong.
The testing form I used is not a silver bullet, but it will make your life easier (and the life of your bosses).
The bottom line is that the only time I didn't use testing was if I were a kind of masochist working for my worst enemy, and I wanted to make my life a hell.
Contango May 05 '13 at 14:00 2013-05-05 14:00
source share