JMLUnitNG Release History


1.4 - 22 May 2014
  • Added support for OpenJML RAC, which is now the default! This support works with the current version of the OpenJML compiler, and may not continue working if OpenJML RAC changes internally, but I will make every effort to keep it working.
  • Fixed an issue where test methods would be inappropriately generated for model methods in classes under test.
  • Fixed an issue where the last element of an iterator would not be properly generated under some circumstances.
1.3 - 25 January 2012
  • Added object generators, which allow the explicit specification of fresh objects and random primitives in test data strategies. For example, given a class X that takes an int constructor parameters, you can tell JMLUnitNG to generate fresh instances of X with random integers within the range low to high using “new Instantiator(X.class, new RandomInteger(low, high))”. See the Javadoc documentation for ObjectGenerator and its implementing classes for more details about their interfaces.
  • Added the ability to use reflection to recursively instantiate test data objects. For example, given a Serializable class X that takes a Serializable constructor parameter, the constructor for X can be passed an instance of X as a parameter, which was in turn constructed with an instance of X as a constructor parameter, etc. (this works for any circular set of dependencies). The depth is 0 by default, meaning that any recursively generated instance of an object must be constructed using the default constructor or a non-recursive constructor - and matching the behavior of previous JMLUnitNG versions - but can be changed (at any scope) in the generated test classes to an arbitrary integer. As with generated array dimensions, this depth parameter should be used with care as recursive instantiation can generate an extremely large number of objects.
  • Added the –-parallel command line option, to automatically fill in the appropriate annotations for parallel data providers.
  • Dramatically improved the efficiency of reflective test data generation.
  • Fixed a bug that occasionally caused reflectively generated objects to be reused, instead of regenerated, for subsequent tests.
  • Fixed a bug where a class would not be detected as a child of an interface that it implemented directly. Previously, if a class under test declared “implements Serializable”, it would not be used when Serializable parameters were needed, but if it inherited the Serializable interface from its parent class, it would; now it is used in both cases.
  • Updated the internal version of TestNG to current source (version 6.3.2 development build), and made several internal changes to it; in particular, memory usage is far more efficient than it previously was, especially with parallel data providers that have many elements.

1.2 - 12 September 2011
  • Changed default test values for numeric types. Previously, JMLUnitNG used the same default values for numeric types as the original JMLUnit: -1, 0, and 1 (except for char, which does not support negative values and therefore had only two default values). It now uses 0 and the extrema of each type (MAX_VALUE for char, MIN_VALUE and MAX_VALUE for int, long, and short; NEGATIVE_INFINITY and POSITIVE_INFINITY for float and double). The default values can, as always, be overridden at the class or package levels if necessary.
  • Fixed an StringTemplate usage issue that prevented JMLUnitNG from starting on Windows.
  • Improved runtime feedback so that messages of the form “not generating X” do not display at inappropriate times.
  • Fixed an issue where class literals of array types (e.g., x instanceof Integer[]) would cause the test generator to fail.

1.1 - 29 July 2011
  • As of this version, running in a Java 7 VM is strongly recommended. You can run JMLUnitNG in a Java 6 VM (even Apple’s), but to do so you must add jmlunitng.jar (or, alternatively, a current openjml.jar) to the boot classpath of the VM. A message telling you how to do this will appear if you attempt to run JMLUnitNG in a Java 6 VM.
  • Updated packaged libraries to the latest release versions of ANTLR, StringTemplate, and OpenJML.
  • Removed fully qualified package names from the generated filenames for method parameter generator classes (this was causing filenames to exceed filesystem name length limits), replacing the package names with a number for disambiguation in the highly unlikely event that two method signatures in the same class contain identically named classes from different packages in the same order.
  • Added the --literals and --spec-literals command line options, to automatically fill in local and class-level test data with primitive literals, String literals, and Class literals (both in instanceof statements and as AClassLiteral.class) found in code and specifications respectively. These options also cause detected Class literals to be used when determining child classes to reflectively create as test parameters.
  • Replaced all calls to System.exit() within non-bootstrap code with throws of new Error subclass JMLUnitNGError, to prevent unwanted VM exits when invoking JMLUnitNG programmatically.
  • Created a new JMLUnitNGConfiguration class that can be used instead of a fabricated CLOPS option store when invoking JMLUnitNG programmatically.
  • Added code to detect classes with insufficiently visible constructors for testing (i.e., a class with only a protected constructor when JMLUnitNG is set to only test public methods).
  • Fixed testing of methods that have arrays of generic type parameters as parameters (for example, a method that takes a T[] in a class with type parameter T).
  • Fixed testing of package (i.e., default protection level) and protected classes, by moving the generated instance strategy class for a class under test to the same package level as the class under test. This slightly increases clutter at that level (there are both _JML_Test and _InstanceStrategy classes created there), but does allow such classes to actually be tested.
  • Renamed the exceptions caught within generated test methods from e to $e, to avoid interference with any method parameters named e.
  • Updated the test class generator to generate tests for concrete static methods of abstract classes.
  • Fixed command line parsing to allow Jar files to be used in the parameters to --classpath and --specspath.
  • Fixed the test class generator to no longer generate unnecessary instance data providers for static methods with no parameters.

1.0 - 13 May 2011
  • Fixed a bug that prevented reflective test generation from working in some cases.
  • Fixed a typographical error in the command line help text.
  • Added the ability to randomly sample the generated test cases; while this isn’t “random testing”, it does let you choose to run a random subset (with a fraction of your choosing) of the generated tests.

1.0b2 - 15 February 2011
  • Added detection (and prevention) of constructor loops during reflective generation of test data. Previously, if there were two (or more) classes under test with circular constructors (such as classes A and B with constructors A(B b) and B(A a)), test data generation would fail due to stack overflow caused by repeatedly calling generators for the classes in an attempt to reach a “base case”. Now, these circularities are detected; in the event that a class has already been traversed during a particular reflective instantiation attempt, the “base case” values generated are the developer-specified values for the class, null and the object returned by the class’s default constructor (if one exists).
  • Fixed a bug in the custom test listener that caused it to not report parameters passed to constructors.

1.0b1 - 3 February 2011
  • Enabled reflective generation of arrays. This uses the data strategies for the array component types (and their child types, if specified), along with a specification of a maximum array length, to generate all possible arrays. This can result in absurdly large numbers of arrays; for example, the strategy for type int[][][] with a maximum length of 2, using strategies for int[][] and int[] with maximum lengths of 3, generates nearly 5 billion int[][][]s using only the default integer values of -1, 0 and 1. Reflective generation of arrays should therefore be used with caution.
  • Fixed the handling of array types. Previously arrays were treated as their component types (meaning methods like main could not be tested). Now, strategy classes are generated for array types and can be modified like any other strategy classes. For multi-dimensional array types, multiple strategy classes are generated (one for each dimension) because of the fact that, in Java, multi-dimensional arrays are really arrays of arrays.
  • Changed the terminology for the various levels of data specification; there are now “local” (method parameter), “class”, “package”, and “default” data values.
  • Added the ability to specify data values across an entire package. This results in the generation of a few more source files (package-level strategies for each data type) but adds significant flexibility.
  • Added proper handling of JML signals_only clauses, by catching exceptions that appear in signals_only clauses and considering a test “passed” if RAC does not generate an error.
  • Fixed the command line help to accurately reflect parameters (there is, in fact, no “--enum” parameter in this release or the previous one).

1.0a2 - 25 December 2010
  • Added API documentation and release history to the website.
  • Included a version of TestNG modified to use minimal memory as described in the FoVeOOS paper. Note that the included version of TestNG is not a fully functional version in that it forgets all the tests it has run; however, it can be used with appropriate custom test listeners to stream test results to disk, including the parameters and objects used, with whatever detail you choose. It works for both sequential and parallel testing on a single virtual machine. The included custom test listener simply prints “Passed”, “Failed”, or “Skipped” with information about each test run on a single (human-readable) line.
  • Added the ability to automatically (with command line parameter --children) use instances of children of declared types as method parameters in generated tests. For instance, an equals method, which takes a java.lang.Object parameter, will be tested with instances of all the different child classes of Object that were referenced when generating the test classes. This functionality is implemented with the addDataClass method of ObjectStrategy, called in the constructors of generated global strategy classes; the precise classes used can therefore be easily changed after the strategy classes are generated.
  • Added proper handling of JML signals clauses, by catching exceptions that appear in signals clauses and considering a test “passed” if RAC does not generate an error.
  • Added the ability to deduplicate test data of primitive types before use; therefore, accidentally adding the same integer in both a global strategy and a specific parameter strategy no longer causes the running of extra, redundant tests.
  • Turned off generation of test classes for enum types.
  • Changed data generation so that all enum constants of a given enum type are always generated by default when test data of that type is needed.
  • Changed cleanup routine to delete class files as well as source files for cleaned-up generated classes.

1.0a1 - 28 September 2010
  • Initial release