|
Page 2 of 6 IndicThreads >> JUnit is currently the most widely used framework, so could you give us a comparison of JUnit and JTiger and how does one decide which unit testing framework to use? Tony Morris >> The primary reason you would use JUnit over JTiger is when your test cases must execute under a Java Runtime Environment with a version less than 1.5 for some unforeseen reason. It is important to note that this does mean that the code under test must target a JRE version 1.5; it may target any runtime version 1.2 or higher. I cant think of any other legitimate reason.
"Only reason to use JUnit is if your code must run in a version prior to 1.5..."
JTiger expresses metadata as language annotations, which are new in version 1.5, where JUnit expresses metadata in some ad hoc fashion. For example, a JUnit test case is one that is prefixed with the name test. Using language annotations provides compile-time enforcement and runtime discovery of the metadata should the need arise, for example, in tools (hint: IDE plugins ?). I believe that annotations are one of the most useful features that were added to the Java Language Specification Third Edition. I have written a comparison between JUnit and JTiger at http://www.jtiger.org/articles/comparison-to-junit.html "Using language annotations provides compile-time enforcement and runtime discovery of the metadata...."
JTiger is able to execute JUnit tests, which provides a progressive migration path from JUnit or simply an alternative unit test execution environment with additional features if that is preferred. JTiger arose simply to suit my own needs, and given the encouragement of friends and colleagues, it was agreed that others may benefit from it too, so my employer permitted me to release it under an open source license (CPL v1.0) as my own work. IndicThreads >> Can you give us a simple example of a test case using JUnit and one using JTiger? Tony Morris >> Ill try to be unbias :) Consider the following typical requirement A Person type that has a first and last name, is Serializable since we need to send instances over the wire, and adheres to the Object equals/hashCode method contracts.
|