testdriven.com Wrangling quality out of chaos

Archive for the ‘Java’ Category

Mockrunner 0.3.7 released

04.16.2006 · Posted in Java

The main feature of this release is multiple result set support for the JDBC test framework.

Other changes include:

- improved JDBC batch processing
- support for custom JNDI implementations
- TryCatchFinally support for the tag test framework
- many minor improvements and bug fixes

You can download this version from http://mockrunner.sourceforge.net

SwitchUnit plugin for Eclipse

03.29.2006 · Posted in Java

I’ve been working on a little plugin for Eclipse that lets you switch quickly between a class and its test case. If the class/test is not found, the appropriate class creation wizard is opened (which you can turn off in preferences).

Check it out here.

Channing

rMock2.0.0 – a Java virtual mock framework, alpha 2 release

10.26.2005 · Posted in Java

We have just released the second alpha of a new Java virtual mocking framework called rMock, available here.

It is based upon the ideas of jMock and EasyMock, and combines what we feel is the best of the two frameworks. There are some differences in how the expectations are managed, and the long-term goals of the project are more radical.[font=Verdana]
Current features:
* Mocking of interfaces and objects
* Stubbing of objects with expectations as restrictions
* Setup expectations on the actual method of the mocked object to enable IDE supported refactoring, code completion and code creation.
* Expectation modification regarding
– arguments
– return value
– exception throwing
– call multiplicity
* A describable Expression/Constraint model supporting advanced asserts and error messages
* DynamicSuites that are flexibly configurable to include or exclude test classes depending on their runtime properties (no more include="**/Test*")
* Nestable ordered and unordered sections for grouping and ordering expectations with clear error messages

On the short-term feature list we have:
* Thread related testing tools
* Internal message bus for publisher-subsciber notifications of testing events
* Plugin-model to hook on to the message bus

On the longer term feature list we have:
* Using the test cases to
– Test-drive and generate correct and up-to-date code and documentation
– Test-drive and generate correct and up-to-date Swing/SWT/Web GUIs and their usage documentation
– Test-drive hardware configurations
– Test-drive deployment
– Generate correct and up-to-date hardware configuration and deployment documentation
[/font]

The background is that almost all relevant project information is reasonable to provide, or already available, in the test cases.

By providing means in the testing framework to utilize this information we believe that the project documentation can be generated from the test cases. This holds for everything from documenting the smallest piece of software up to acceptance testing a GUI or deploying to a global server farm.

Please, try it out and get back to us with any kind of feedback!

Best regards,
Ola Ellnestam on behalf of The rMock team

Announcing TestNG 4.0

10.11.2005 · Posted in Java

The TestNG team is happy to announce the immediate availability of TestNG 4.0, with a lot of improvements and new features.

The announcement, along with a few examples and summary of the new features, can be found here.


Cédric

http://testng.org

Mockrunner 0.3.6 released

09.30.2005 · Posted in Java

This release contains the first version of the new JCA test framework developed by Gábor Lipták. The framework can be used to simulate backend systems that are accessed through a JCA connector, e.g. mainframes.Other changes include:

- The mock object factories now use factory methods to create mock objects making them more extensible. This allows the use of custom mock objects.
- Mockrunner is now officially Java 5 (aka 1.5) compatible. Java 5, 1.4. and 1.3 are supported from now on.
- The Struts test framework now supports custom ActionMapping subclasses.
- The JDBC test framework now supports generated keys
- Improved out parameter handling for callable statements
- Added new ArrayResultSetFactory implemented by Erick G. Reid
- Added a method to easily preload JMS mock destinations with test messages
- Refactored JMS session handling so that closed session are removed from destinations (preventing a memory leak that may occur in special cases)
- Many minor improvements and bug fixes

Please check out the release on our site for the new version and examples for the new JCA test framework.

TestNG 2.4 released

07.06.2005 · Posted in Java

The TestNG team is happy to announce the release of TestNG 2.4 at testng.org.

The complete announcement (with links) can be found here.

A lot of fixes and improvements have gone into this release (see the complete list) but the most important feature is the new Web site (testng.org) and the new packaging (org.testng.*).

There are also a couple of items I want to mention briefly:

* A Flash demo of the Eclipse plug-in, created by Andrew Glover (who also set up a TestNG site with articles and resources).
* A TestNG Maven plug-in. I couldn’t include it in this release, but it is now part of our CVS depot and will be included in 2.4.1.

Big thanks go to Alexandru Popescu, Andrew Glover, Thierry Janaudy and Russel Winder for their participation to this new release!

You can download TestNG 2.4 here. The Eclipse plug-in has also been updated to this new version and can be obtained from the update site.

Toplink in memory to run your tests faster

07.06.2005 · Posted in Java

[url=http://www.testdriven.com/modules/mylinks/visit.php?cid=4&lid=1038]Toplink In Memory[/url] is an open source project that allows you to run your database tests in memory. If you’re using toplink and TDD, this package can help you reduce the amount of time it takes you to run all your tests.

Fewer failing tests due to test interaction, Toplink in Memory automatically deletes all the objects you created during the test – but leaves the fixtures in the database untouched.

How does it do this? Well, it stubs out the database. When in production, ToplinkInMemory calls Oracles Toplink normally – which uses the database. During testing all the objects are created in memory and only in memory. NOTHING is written to a disk. And none of those pesky transactions (expensive) are used to save even more time during test runs.

This library was created out of need. We are currently running 4700 tests which take multiple hours to run against the database. Our in memory framework allows us to run them in as little as five minutes. We hope it will be of use to you.

Ted O’Grady

Announcing TestNG 2.3

04.13.2005 · Posted in Java

The TestNG team is happy to announce the availability of TestNG 2.3.

The version is available here as well as the new documentation, which has been considerably improved (highlighted code snippets, detailed DTD, ant task and description of all the new features).What’s new:

* beforeSuite, afterSuite, beforeTest, afterTest
* Revamped ant task with haltonfailure and other helpful flags
* Better stack traces and improved level control for verbosity
* Better syntax for including and excluding methods in testng.xml
* Test classes can be invoked on the command line
* … and many bug fixes.

For Eclipse users, a new version (1.1.1) of the Eclipse plug-in that includes this new TestNG version is available on the remote update site or for direct download.

Also, TestNG has joined OpenSymphony (big thanks to Patrick and Hani for setting this up). As a consequence of this move, there is now a TestNG users forum as well as a Wiki and JIRA for issue tracking.

The users mailing-list has been moved to Google Groups and is connected to the forum, so you only need to subscribe to one.

Try it and let us know what you think!

JUnitX 5.2: test private methods without polluting production code

03.30.2005 · Posted in Java

[First, this news is not about the alphaworks JUnitX project (assertions extensions) but about the original extreme-java.de one (private/protected methods testing).]

I just wrote a little tutorial explaining how to use JUnitX to test private parts of your code. Its purpose is not to choose a camp (testing private parts or not), but to explain how to use JUnitX in case you need it, not the "why" of its use.

For our project needs, I’ve recently played with the JUnitX source code and patched it to make it easier to use: combined with javassist, this version not longer needs you to create TestProxy classes in your production code. (see section " JUnitX 5.2 -> No need for TestProxy !", to download this version)

Original version was created by Andreas Heilwagen but this project doesn’t seem to be supported anymore :(

Changelog for this version:
.avoid TestProxy classes creation
.static private methods testing.

Comments and remarks welcome.

JUnitX How to

Announcing TestNG for Eclipse

03.30.2005 · Posted in Java

The TestNG team is happy to announce the first release of the TestNG plug-in for Eclipse.

This first release covers the basic functionalities of TestNG, among which:

* Multiple ways to launch tests (from a method, from a class, groups or an entire suite).
* Convenient report view that lets you directly jump to failed tests.

A more detailed overview can be found here, and the documentation and snapshots here.


Cedric

JUnitScenario 0.1 released

03.05.2005 · Posted in Java

JunitScenario is an automation framework on top of JUnit to perform functional tests and stressing tests. JUnitScenario is a tool to simulate real life usage of applications. It allows you to describe scenarios that are composed of unit tests calls and simulate several users following those scenarios.

Visit JUnitScenario for more details.

Announcing TestNG 2.1

02.09.2005 · Posted in Java

I am happy to announce the availability of TestNG 2.1 (http://beust.com/testng). Some of the new features include:

* invocationCount and successPercentage, which I described in a previous entry (http://beust.com/weblog/archives/000236.html), and which allow you to invoke a test method a certain number of times while allowing some of these invocations to fail. If the number of failures is under a certain threshold, the test is still considered a success.

* timeOut is now applicable to all test methods. Whether you are running your tests in parallel or not, you can specify a time-out for your test method and if it fails to complete within the given amount of time, TestNG will mark it as a failure.

* dependsOnMethods was the most requested feature. You can now specify dependencies on a method-based basis (no need to specify a group if your dependency graph is simple). You can even mix dependsOnMethods and dependsOnGroups.

* … and of course, numerous bug fixes and other additions.

A special thanks to Alexandru Popescu who has pulled all-nighters to make this release happen!

We have an exciting list of new features lined up for our next version, among which a plug-in API, but in the meantime, enjoy TestNG 2.1.

TestNG 1.0 released

09.02.2004 · Posted in Java

Cedric Beust has released the first version of TestNG.

From the release announcement:

"As a quick reminder, TestNG is a testing framework using annotations to provide a more powerful way to test your code in various ways: unit, regression, functional, integration, etc… TestNG allows you to clearly separate your Java code from the way your tests are run. You never need to recompile any of your classes if you decide to run a different set of tests or suites.

TestNG also provides a very flexible configuration mechanism allowing you to specify arbitrary methods to be invoked at particular moments during your test run, such as ‘before every test method’ or ‘after all the test methods have run’."

Visit TestNG’s [url=http://www.testdriven.com/modules/mylinks/visit.php?cid=4&lid=380]home page[/url].

MockRunner 0.3 released

08.27.2004 · Posted in Java

Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports Struts actions, servlets, filters and tag classes. It also includes a JDBC and a JMS test framework and can be used to test EJB based applications.

This major release provides:

- Struts 1.2 support (please read migratingfrom0.2.9.txt for details, there are some incompatibilities with previous versions). Struts 1.1 is still supported.
- Regular expression support for JDBC statement preparation and verification (please note, that you have to enable this feature with setUseRegularExpressions(true))
- Regular expression support for HTML output verification
- many small bug fixes
- MockEJB 0.6 support is still pending

Visit [url=http://www.testdriven.com/modules/mylinks/visit.php?cid=12&lid=216]MockRunner[/url] for more information.

JDemo 1.0.3 released

07.05.2004 · Posted in Java

"One day in early 2003 I found myself writing a JUnit test method that was not really meant to be an automatic test, but rather a little piece of code making some kind of graphical output I was interested in. I was tempted to use the unit test approach because I already had some code for initializing my software library in a unit test. By adding a few lines like Thread.sleep(10000) and frame.show() to the test and starting the TestRunner I was able to test drive the program and evaluate its output."

JDemo provides a uniform and straightforward way for writing code snippets similar to unit testing code. The code snippets can be used to demonstrate both the code usage and the output of the program – either to the screen, to a file or just to System.out or System.err. Furthermore the demo code can be used for documentation purposes.The author has found several noteworthy uses of this type of framework (taken from the documentation page): API improvement, interactive testing (writing demos for GUI components enables developers to run the dialogs they are working on, without having to start the whole application), decoupled code (writing code snippets, only demonstrating a small piece of the code, requires a more modular code design), code documentation (simple code snippets are a valuable resource for documenting proper usage), easier library evaluation (uniform frameworks for writing and running demonstration code like with JDemo make it much easier for developers to find out whether the library fits their needs and how it must be used), reduced code duplication, automated documentation (each demo has a unique identifier that can be used to run the demo from within a build script to provide automatic captures).

JDemo also released plugins for Eclipse 2.1 and 3.0.

Visit JDemo’s home page.

JAM*Tester, tool for TDD teachers and students, made available

07.01.2004 · Posted in Java

Young student David Poll, under the guidance of his high school computer science teacher Dave Wittry, has developed JAM*Tester, a project to make JUnit testing more accessible to both teachers and students.

The resulting tool has just been made available.JAM*Tester (JUnit Auto-Matic Tester), in its Student Version, is an aid in the creation of JUnit TestCases, runs the tests, reports JUnit results, and provides some code-coverage reporting (parts courtesy of Clover). View the student demo.

With the Teacher Version of the tool, a teacher can create a battery of tests for their students’ labs, and then automatically compile and run the tests for all of their students at once. View the teacher demo.

"Since a teacher will be designing a test class anyway in order to grade their lab, he or she can give students a not-so-complete version of their test class that they can use to test their class before turning it in. Students just add it to their project and, using the student tool, run the tests [to] know if they are on the right track. But, of course, not a complete battery of tests is included in what the teacher would give them; they still go through the exercise of creating thorough test data."

JAM*Tester may be obtained from here.

Java tool EMMA provides coverage as a side effect of unit testing

06.29.2004 · Posted in Java

Vladrim Roubtsov, of Trilogy, has released EMMA, a code coverage tool for Java.

"EMMA’s mission is to move code coverage from an infrequent release gate (possibly run on a dedicated ‘coverage’ machine because the license is too expensive for the entire team) to the domain of agile testing and development (‘check coverage while still writing testcases and before you check code in’). Coupled with a very liberal license, EMMA is a tool that provides code coverage stats as an easy side effect of unit testing itself."Based on bytecode instrumentation, EMMA uses a fast bytecode processor (~2ms/class), and can do instrumentation incrementally or "on-the-fly", without a special preparation phase.

"EMMA is free/open source and at the same time coded from a commercial software developer’s point of view: it works in any (not just the latest and greatest beta from Sun) Java 2 runtime and scales to very large projects (the largest single instrumentation run so far covered 20000+ classes). It has no external dependencies and is not tied to any particular testing framework."

Visit EMMA’s home page, SourceForge Project page.
Read Trilogy’s press release.

Java GUI testing framework: Abbot 0.12.3 released

06.18.2004 · Posted in Java

The Abbot framework is a Java library for GUI unit testing and functional testing. It provides methods to reproduce user actions and examine the state of GUI components. The framework may be invoked directly from Java code or accessed without programming through the use of scripts.

Mainly a bug fix release.Bug Fixes

- Fix apparent hang/freeze when recording/selecting components, especially with children of JTabbedPanes or other components which hide their children. Fix XSD; args attribute is not required on call steps.
- Fix strongly held reference when filtering components (nixnixnix).
- Fix NPE when recording null-valued selections in JTable/JList.
- Fix class cast exception when running scripts and reporting step status.
- Workaround disabled menus bug on OSX. Fix Robot verification w/1.4.2_04.
- Fix broken example scripts (fontchooser) (thanks to quikdraw).
- Fix editor tutorial script so that it runs outside of the editor.
- Fix several bugs selecting methods in the Assert step.
- Fix script context parsing error with w32 drive letters.
- Removed deprecated classes.
- Ensure most objects used in a test may be GC’d after a test run. Mostly affects the Abbot test suite.
- Fix test fixture timing issues that were causing lost key/mouse events.

Go to Abbot’s home, read the release notes, download Abbot, view the API.

PicoContainer 1.0 released

06.17.2004 · Posted in Java

The PicoContainer team has announced the final release of PicoContainer 1.0.

PicoContainer helped popularize Dependency Injection (particularly Constructor Injection), a software pattern that helps developers keep their code simple and testable.PicoContainer is a lightweight container. It is not not a replacement for a J2EE container, as it doesn’t offer any infrastructure services out of the box, but its Dependency Injection feature provides a way of instantiating components and lacing them together with other dependent components.

Non-intrusive, PicoContainer doesn’t require implementing any funny APIs. They can be POJOs. With lifecycle support built-in and a very extensible design enabling virtually any form of extensions to the core, PicoContainer is embeddable inside other applications, and can help you write better code.

Read the press release.
Visit PicoContainer’s home page.
Visit Martin Fowler’s pages on Inversion of Control.

jMock 1.0.1 released

06.09.2004 · Posted in Java

jMock 1.0.1, a library for testing Java code using mock objects, was released last Monday. Mock objects help design and test interactions between objects.The jMock package:
- makes it quick and easy to define mock objects, so you don’t break the rhythm of programming;
- lets you define flexible constraints over object interactions, reducing the brittleness of your tests;
- is easy to extend.

Changes from 1.0.0
- Fixed bug in error messages that report verify failures
- Various minor error message improvements

Binary and source distributions and documentation can be downloaded from here.

Spring framework 1.0.2 released

06.03.2004 · Posted in Java

Spring is a layered Java/J2EE application framework, based on code published in Expert One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002).

Among the enhancements in this release is the new "mock" source tree and "spring-mock" jar file, containing JNDI and Servlet API mocks for usage in applications.Spring’s mission statement states that Spring reduces the complexity cost of using interfaces to zero, and considers testability essential.

Read the press release.
View Spring’s documentation.

JAM (Ant build toolkit for J2EE applications) released

05.22.2004 · Posted in Java

JAM consists of a collection of Ant scripts designed to perform common Java/J2EE build tasks such as compilation, packaging, testing, deployment and J2EE application server control. By assembling JAM modules, one is able to quickly create sophisticated IDE-independent build scripts. JAM supports various J2EE application servers, XDoclet invocation, JUnit unit testing, Apache Cactus integration testing, UML-based code generation and other technologies.

Although JAM was developed to complement the JavaGen code generator, it has evolved into a full feature, stand-alone build framework.Optional JAM modules are available for unit testing and integration testing:

utest.xml adds unit testing to the build process (standard target: test).
ejbtest-cactus.xml adds Cactus integration testing to your build process (tandard targets: itest, testcycle).

Read JAM’s User Guide.
For an example usage, read EJB JAMing – Building & Testing EJBs using JAM.
Jump to JavaGen’s download page.

EasyMock 1.1 extends the dynamic mock creation to regular classes

05.13.2004 · Posted in Java

The first extension to EasyMock has been made available in the latest release of EasyMock. With the help of cglib, it allows generating mock objects for classes.

EasyMock is a class library that provides an easy way to use Mock Objects for given Java interfaces.In addition, release 1.1 features the following changes:

- ParameterMatcher renamed to ArgumentsMatcher, since it matches arguments, not parameters
- parameterMatches() and parameterToString() on AbstractMatcher renamed to argumentMatches() and argumentToString(), since they work on arguments, not parameters
- tests extended to gain 100% clover coverage
- internal refactorings

EasyMock 1.1 is available as a jar file from the EasyMock download page.
Read EasyMock’s documentation.
Visit EasyMock’s Yahoo! Group.

(via Lasse Koskela’s blog)

Shunra\Stratus 2.0: Performance unit testing enabled

05.10.2004 · Posted in Java

Shunra Software recently announced Shunra\Stratus 2.0, which provides performance unit testing for distributed application code.

Intended to provide for unit testing under network conditions, Shunra\Stratus features a network emulation technology to let developers gauge how their application modules perform in a production environment. Developers can record and playback the production environment directly from their desktops.From the Shunra site:

"An essential component of unit testing, Shunra\Stratus lets software developers see and feel exactly how their application modules perform over the production environment, directly from their desktops. Using Shunra\Stratus’ network emulation technology, the application code behaves as if it were located on a remote desktop, connecting to the datacenter over a wide area network, instead of a local network. With this insight, developers can simply and quickly locate and resolve network-related design, functionality and performance-related flaws within their code."

Read the press release.
Download a free trial.

Jameleon 2.0 released

05.01.2004 · Posted in Java

[img align=right]http://jameleon.sourceforge.net/images/top_logo_100.jpg[/img]Jameleon, the acceptance-level automated testing tool, has just been updated to version 2.0.

Among the changes in this release, the major improvement lies in Jameleon’s ability to control the behavior of function tags based on JavaDocs alone, which greatly simplifies the tag-creation process.

All major features required for user interfacing have been implemented in this release. Future releases will focus more specifically on the GUI.Christian Hargraves and the Jameleon team recommend that everyone read the new tutorial that documents all new features in this release and in the previous 1.8 release. It is also recommended that everyone read the the [url=http://sourceforge.net/project/shownotes.php?group_id=84246&release_id=174733]release notes[/url] for upgrade instructions and more details on the four changes introduced by this release.

Jameleon uses Jelly, [url=http://www.testdriven.com/modules/mylinks/singlelink.php?cid=21&lid=98]HttpUnit[/url], [url=http://www.testdriven.com/modules/mylinks/singlelink.php?cid=4&lid=3]JUnit[/url], Log4j and [url=http://www.testdriven.com/modules/mylinks/singlelink.php?cid=21&lid=162]JWebUnit[/url].

Go to Jameleon’s home page.