Code generation for unit testing

Code generation for unit testing

There exists a project at Microsoft which generate unit tests based of source code. The name of this interesting project is Pex.At the first time when I heard about this project I was skeptical. Where’s the value of generated tests? Doesn’t it break the “test first” approach? After I saw this screencast from the PDC 2008, I could find the answers for me:There is a value: It is often tedious to write all the unit tests with the extreme values…

Read More Read More

Fall-thru or not to fall through

Fall-thru or not to fall through

There is a little differences how C# and Java implement the switch-statement. I discovered it when I want to implement a fall through in C#. In Java it is very simple: just leave the break statement at the end of the case block away. In C# it doesn’t work like that. There is no implicit fall through (with one exception: The case blocks have to be empty). You have to implement it explicit by add at the end of the…

Read More Read More

Are 100% code coverage reasonable?

Are 100% code coverage reasonable?

When you use a code coverage tool one of the first question is what is a good code coverage. Recently I listened to different podcasts (stackoverflow, scott hanselman) where they discuss this topic. I wasn’t really surprised that there wasn’t one unique opinion.One opinion was that 100% is a good number, an other opinion was that for non-failing code it doesn’t make sense to build a test, so 100% isn’t a good number for most of the projects.The last opinion…

Read More Read More

Eat your own dog food

Eat your own dog food

Recently I heard the expression “eat your own dog food” again. For a company which produce software for a customer it is very usefull to use the same technology or product in house. But this expression is also usefull in the daily business of a modern software developer. One big advantage of test driven development (TDD) is, that you change the perspective before you code a class or a method. In the test first approach you create the test before…

Read More Read More