May 13, 2009

CM Toolbox

Surround SCM

Works with TestTrack 2009 and Surround SCM 2009

A few days ago I posted an article on how to create a defect list using Java. This builds on top of that, bringing in Surround SCM. This application will show you only defects that have files attached from the specified branch. Used in conjunction with TestTrack filters, this application can give you the list of files you are looking for.
Figure 1 - Main window

How it works

The first thing you must do is set up your configuration file.

Configuration File

This file must reside on the same directory as the JAR file. The application reads this file to determine the location of the TestTrack SOAP CGI, the Surround SCM server, the Surround SCM Command line client as well as the user name and password to use. The same user name and password is used to connect to both applications. The file is called Config.xml and here is the structure of the file:
<?xml version="1.0"?>
This is an example of how the file may look in linux:
<?xml version="1.0"?>
<Project>Sample Project</Project>
Note that the SCMServer tag must contain the server address and port, separated by a colon. Also the SSCMEXEC tag must also contain the binary file name as well. In Windows, this would be C:Program FilesSeapineSurround SCMsscm.exe.

Running the app

Once the configuration file is set up, you can run the application. To run this, you can launch it from a command prompt/terminal window with the following command:
java -jar "CM Toolbox.jar"

Using the app

The application basically runs a query that returns the list of defects that have files associated from a specified branch in Surround SCM. Then, for each defect, you can see the files associated. First, you must provide the application what to search for. Surround SCM Mainline: Choose a Surround SCM mainline to get the list of branches for that mainline. Surround SCM Branch: Choose the Surround SCM branch to use in the search. TestTrack Filter: Choose a filter if you are interested in a subset of defects, or to reduce the time it takes to retrieve the list of defects. The filter has to exist in the TestTrack project and has to be available to the user making the SOAP calls. Get Defects: Once you have defined your search criteria, click on the Get Defects button to retrieve the list. Once the list of defects is displayed, select a defect to view the list of files and version(s) associated to the defect from the branch specified.

About the NetBeans project

The application is a Java Desktop application created with NetBeans 6.1, and it needs a library reference and a Jar file added. Using the Plugins interface, download the plug in for JAX-RPC Web Services. Then, you will need to add the TestTrack SOAP java classes, which you can download from here. Also, note that all of these libraries are in the dist/lib folder in the Download.

Things of note

This should be considered version 1.0 of this utility. As time allows, improvements will be added. I also welcome anyone who wishes to make modifications and post the modified project here as well. Just make sure you upload it as a different file name so you don't overwrite the original. Following are some ideas on improvements:

Better error checking

At this point, there are several try/catch statements, but there aren't any message boxes that pop up with errors. For example, a message box could pop up if the configuration file is not found, or it has data missing. I also have not tested this extensively to have caught every possible scenario that could cause the application to not work correctly. This is why I provide the NetBeans project, so you can debug it if you do encounter issues.

Surround SCM commands


At the least, there should be a way to get the files. This is probably the next thing I will be working on. It is worth noting that at this time, if a file is attached multiple times to a defect in TestTrack, each version is listed separartely as illustrated below.

Figure 2 - Multiple versions


Another useful feature would be to diff the files. Specifically, diff the version of the file attached versus its previous version. This would be very similar to a utility I wrote some time ago that you can find here.

View File

Instead of getting the file, maybe you just want to view it. This may take more work, especially if we want to keep this cross-platform. While a text file could be displayed in a multi-line text box, binary files would present a challenge.

Show file in the Surround SCM client

When a file is selected, we could build a sscm:// hyperlink using the server connection information contained in the configuration file. Then we could pass it to the Surround SCM client executable. This would give us the similar behavior as the Find in Files Utility

Known issues

While testing this on Fedora Core 8, I noticed that the list of branches does not populate if your mainline name has spaces. This was not the case when I tested it on Windows XP. I ran a debug on Fedore Core 8 and as of this writing could not figure out why. More details to follow.


You can download the entire NetBeans (6.1) project from here