Testing Framework

This forum is used to discuss the architecture and design of the next JPatch development version (Jpatch 0.7).

Testing Framework

Postby sascha » Fri Nov 07, 2008 10:39 am

I've finally convinced myself that the JPatch code needs more testing. Of course I always did some automated testing, but most test-cases were scattered across several testing main(String[] args) methods, and I didn't run them periodically.

I gave JUnit a try, but I'm not really happy with it. I see that it's important to test the public interface of each class, but I'd also like to test implementation details (private methods and state), at least when complex algorithms are involved. This is something JUnit can't do (I don't want to use reflection in test-code).

So I wrote my own very simple, yet powerful testing framework. It scans all classes for sub-classes annotated with a @TestSuit annotation. If it finds such a class, it instanciates an object and runs every method annotated with @TestCase - these methods return TestResults, which can be success, warning or error, with a detailed error message and class/method/line-number information.

Since the @TestSuits are subclasses of the classes under test, they also have access to private methods and fields. This should make finding bugs easier, and also help to prevent the introduction of new ones.
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Return to JPatch 0.7 development

Who is online

Users browsing this forum: No registered users and 1 guest

cron