Writing unittests for KDevelop pluginsFebruary 17, 2010 at 4:00 pm | Posted in KDevelop | Comments Off
After just completing a basic unit-test for a KDevelop4 plugin I’m currently working on I realized that its really easy, but we lack some simple examples how to do this.
So I sat down and added an article to our Wiki that explains how a basic unittests for a KDevelop4 plugin is structured and how it works.
Its really important that setting up the necessary environment for unittests is easy, at least thats what my personal experience has taught me. If writing a unittest for a small bug one has found takes more than a couple of minutes because of tons of extra things to write (like having to implement certain interface classes with some dummy values, or setting up a complete gui first), then those unittests will never be written. The exception might be people being paid to write those, but this is seldomly the case in open source projects.
Hence its important to make it possible to add a new test for a feature or bug in as few lines as possible, concentrating only on the particular circuumstances that are required for the bug/feature. So with the above article and the framework KDevPlatform provides, there’s really no excuse anymore for not writing unit-tests for your plugins :)