Sunday, January 06, 2013

ATG DUST – A JUnit framework for ATG applications



Well we all have been writing the classic JUnit tests from years now but it becomes challenging to write test cases when you dealing with framework like ATG.
So here comes ATG DUST - A framework for writing JUnit tests for applications built on the ATG Dynamo platform.

Its indeed makes our life lot simpler by providing some amazing features. The highlight of this framework is that it allows one to quickly write test classes that depends on Nucleus or ATG Repositories. By using ATG DUST one can drastically cut down on development time. It takes only a few seconds to start up a test with a repository, not like application server which takes good time to start up.

To get started go straight to first test page . This page will walk you through the process of running a basic test which starts Nucleus.

This tutorial walks you through the steps of writing a test which does not need to run in an application server. This is one of the underlying benefits of writing unit tests.
The test does not depend upon starting up an application server so turnaround time is also very quick.

Visit out-of-the-box-component-testing page which gives you a feel of simple test class. Try to open the java source (StartWithModulesTest.java) file attached there to get a fair idea how easy to use ATG DUST.

The best part I liked about ATG DUST is having the ability to load any specific ATG module and write a quick Repository test class. Go to the repository test page for a simple example.
The repository is started up against an in-memory Hypersonic Database.

DUST also support Formhandler test features with the help of utility (ServletTestUtils) class which can create a dummy Dynamo Request/Response pair.

Some of the key classes to look at –
atg.adapter.gsa.GSATest - A basic GSA test which has several utility methods.
atg.test.util.DBUtils  - Utility code for getting a connection to a database. The most common method is getHSQLDBInMemoryDBConnection.
atg.test.util.FileUtil  - A collection of utility methods for dealing with the file system.
atg.nucleus.NucleusTestUtils - This class contains some utility methods to make it faster to write a unit test that needs to resolve components against Nucleus.

Note on ATG version support – ATG DUST was developed using 9.0 but it work on most ATG versions back to 7.2 . I used ATG DUST version 1.2.2

Download ATG DUST

Popular Posts