AHrg Documentation |
 |
Contents
- Introduction
- Installation
- Configuration
- Developer Information
- Guide to Writing Your Own Adapters
- AHrg Internals and Design
Introduction
Agile development began in the late 1990's as a collaboration of several emerging
methodologies. Each of these methodologies, while different, all emphasized
close contact between the customer and the development team, frequent and iterative
delivery of a working, even if not fully functional, program, and a process that
allowed requirement shift to be handled with ease. The term 'Agile' was coined
at a workshop in 2001 as an umbrella term for the software development methodologies
represented at the workshop. The similarities between these methods were discussed
and written down as part of the Manifesto for Agile Software Development. The
most important part of the manifesto is a list of shared values:
[...] Through this work we have come to value:
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan
That is, while there is value in the items on
the right, we value the items on the left more.
Even though Agile development values 'Individuals and Interactions over processes
and tools' there is still a need for tools in the development process. The ability
to automate the building and testing of a program under development is a crucial
part of the Agile development process. Since the Agile process emphasizes frequent
builds, it would be a burden on the development team to have to manually organize
and execute a build even on a daily basis. Since builds are happening so frequently
it is equally important to be able to test as often as the builds happen. This way
bugs that are introduced from one build to another are found quickly, before they
become compounded into the program and become a pain to resolve. Finally, having
metric information for every single build fits well into the Agile process as it
can help guide the team's direction as they adapt over the life of their project.
The metics may also raise software quality issues throughout the development of the
project instead of only worrying about software quality in the late stages of
development.
Named AHrg (AH for AgileHelper and rg for the amount of times I made that exclamation
durring development) the tool combines a continuous build tool with testing and
metrics capabilities. This is accomplished through a plugin architechture that
allows existing tools that offered the required functionality to be linked together.
Installation Instructions
This sections details the steps involved in installing AHrg. Before installing
there are several pieces of software required for AHrg to function properly.
There is no need, however, to be daunted as installing these requirements is a
straightforward process. If you need help at any point durring installation, you
can send me an email at gnugy AT users.sourceforge DOT net.
The following pieces of software are required for AHrg to function properly:
- A Java Runtime:
As this is a Java project you will need a Java Runtime installed. This
project was developed using Java 1.5. and is the recommended version (1.4
should work but is not tested). You can obtain the most recent version of
the Java Runtime by following the link found above.
- A Servlet Container:
In order to run AHrg you need to first install a Servlet container. While
any Servlet container will do, AHrg was tested using Apache Tomcat and is
what these instuctions assume you are using. Information on obtaining,
installing and configuring Apache Tomcat can be found
here.
Once Tomcat is installed and configured, deploy AHrg by copying the Ahrg.war
file found in the %AHRG_HOME%/dist directory to the %CATALINA_HOME%/webapps
folder.
- Anthill OS:
AHrg comes packaged with an adapter for using Anthill OS as your continuous
integration tool. In order to use this adapter you will need to download
Anthill (make sure it's the open source version) and unpack the archive
somewhere on your computer. Anthill does not actually need to be 'installed'
as per the instructions found in the Anthill documentation. All that is
required is that the Anthill directory structure is located somewhere on
your computer. If space is a concern not all elements of Anthill are required
and the Anthill installation can be 'gutted'. For more information send an
email to gnugy AT users.sourceforge DOT net.
- Subversion:
Subversion is only necessary if you are using the AnthillAdapter for your project's
Continuous Integration. You need a Subversion server to store your project's files
and a Subversion client installed on the same machine as AHrg so that Anthill
can access the server. Information on configuring Subversion can be found
in the configuration section. Once you've
installed the Subversion server and client you'll want to create a repository
for your project. To create a repository run the following command on the
machine where the Subversion server is located:
svnadmin create path/to/repos
Now that this is done you need to configure your repository so that Anthill
can access it. This is done by editing the svnserve.conf and passwd files
found in the path/to/repos/conf directory. Samples of these files can be
found in ahrg_home/docs/samples. For more information on how to do this
refer to the Subversion documentation. After you've created your repository
you'll want to do an initial commit to put your project into the repository.
You can do this from the command line:
svn import localdir/myproject svn://path/to/repository/myproject
- A SMTP email server:
A second requirement for the AnthillAdapter is a SMTP email server that does
not require authentication. This is in order for Anthill to be able to send
and receive result emails. Apache James was used for this purpose and is the
program that these instructions assume you are using.
Once you have James installed on your computer you will need to configure
it. For local use only (James and AHrg are installed on the same computer)
you only have to set up a RemoteManager Account. More details can be found
here.
The rest of the out-of-the-box configuration will suffice for local use.
Once this is done you will need to use your newly created admin account
to create an email address for each of the projects that you want to use
the AnthillAdapter with. To do this, open a command window and enter the
following:
telnet localhost 4555
You will then be promted for a username and password, enter those that you
specified while configuring your RemoteManager Account. Now for each project
that you wish to configure for the AnthillAdapter, enter the following:
adduser [username] [password]
You will need to remember the username and password entered for setting
up your project.
Actuall installation of AHrg is as simple as deploying the ahrg.war file (found
in the dist directory) to your servlet container.
Configuration Instructions
This section provides details on how to properly configure an AHrg project to use
the AnthillAdapter as it's continuous integration tool, the JUnitTestRunner as it's
test suite and JCSC for providing metric information.
The first thing you need to do is set up your project properly. The AnthillAdapter
expects a couple of things. First of all, it expects to find an Ant build file
called build.xml in your project's root directory. AHrg makes this build file
responsible for moving the project's source to the notify directory so that the
project can be tested and have metrics applied to it whenever it is built. To do
this create a build.xml in your project's root with the following basic structure:
<project name="YourProjectsName" default="all" basedir=".">
<description>Sample Build File for AHrg</description>
<!-- Optional task definitions -->
<taskdef name="jcsc" classpath="d:\Ahrg-install\jcsc\lib\jcsc.jar" classname="rj.tools.jcsc.ant.JCSCTask"/>
<!-- set global properties for this build -->
...
<property name="publishLocation" location="ahrg_home/notify/projectName"/>
...
<target name="all" depends="AHrgNotifyPublish,AHrgMetrics">
<!-- Built the project -->
<echo>Building Project</echo>
</target>
<target name="AHrgNotifyPublish" depends="compile">
<!-- Copy the source files to ahrg_home/notify/projectName/ -->
<mkdir dir="${publishLocation}"/>
<copy todir="${publishLocation}">
<fileset dir="${srcLocation}"/>
</copy>
</target>
<target name="AHrgMetrics" depends="compile">
Ommited, included later in section
</target>
...
Other targets such as making a Jar file etc.
...
<target name="compile" depends="init" description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
Tasks to compile your code here
</target>
<target name="init">
Initialize the build process here.
</target>
</project>
|
The parts that need editing have been bolded. A sample build file can be found
in the top level of the TestApp directory.
The AnthillAdapter also expects to find a file called version.txt in the top level
of your project. This file simply contains a version number for you project.
Anthill will increment this number everytime if performs a build. A sample
version.txt file can be found in the top level of the TestApp directory.
In order for the JCSC metric to be properly applied to your project you need to
modify your project's build.xml file to run the JCSC task and move it's results
to ahrg_home/projects/projectName/JCSC. To do this modify your build.xml as follows:
<project name="YourProjectsName" default="all" basedir=".">
<description>Sample Build File for AHrg</description>
<!-- Optional task definitions -->
<taskdef name="jcsc" classpath="d:\Ahrg-install\jcsc\lib\jcsc.jar" classname="rj.tools.jcsc.ant.JCSCTask"/>
<!-- set global properties for this build -->
...
<property name="metricsLocation" location="ahrg_home/metrics/JCSC/projectName"/>
...
<!-- Project's build targets -->
<target name="all" depends="AHrgNotifyPublish,AHrgMetrics">
<!-- Built the project -->
<echo>Building Project</echo>
</target>
<!-- Notify target is omitted -->
<target name="AHrgMetrics" depends="compile">
<!-- Run the JCSC Ant task on the project's source -->
<jcsc rules="path to rules file"
destdir="${metricsLocation}"
copyassociatedfiles="true"
jcschome="ahrg_home/jcsc">
<fileset dir="${srcLocation}" includes="**\*.java"/>
</jcsc>
</target>
<!-- The rest of the targets have been omitted -->
...
</project>
|
The sections that need editing have been bolded. Some of the file has been
omitted because it is the same as the one above. Please note that JCSC requires
the paths you provide it to be fully qualified or else they will not work. For
more information on using JCSC please refer to the JCSC Homepage.
Now that your project is set up to work with AHrg, you are ready to set up AHrg to build your project.
- Using your web browser navigate to http://ahrg_address:8080/AHrg where
ahrg_address is the address of the machine where your Servlet Container
is running. This assumes a Tomcat installation running on it's default
port 8080.
- If this is the first time anyone has accessed AHrg, you will be directed
to specify the installation directory of AHrg. This is a fully qualified
path to the location of the Ahrg-install directory on the host machine.
Please note that if after entering the directory you are told it is invalid,
make sure that there is a file named AHrgInstallDir in the ahrg_home/conf
directory. This file is used by the program to verify that this is indeed
an AHrg directory. If the file is not there create it. It does not have
to contain anything.
- After specifying ahrg_home you will be taken to the main screen. To
create a new project click on the Create a Project link. This will take
you to the Create a Project screen. Enter the following information:
- Project Name: the name you wish your project the have.
Remember that this name is important to the notify directory.
This name should be the same as the name of the folder that your
project's build script creates in the ahrg_home/notify directory.
- Continuous Integration Adapter: ah.continousintegration.AnthillAdapter
- Testing Adapter: ah.testing.JUnitTestRunner
Now click create.
- After clicking create you arrive at the Adapter Configuration Screen.
Enter the following information:
- CIAdapter:
- anthill.result.email.user: This property contains
the username for the email address where Anthill will send
build result emails for this project. Enter the username
for the email address you set up in James for this project.
- repository.subversion.url: This property holds
the path the Subversion repository where your project is
stored. Assuming you are using Subversion's server on
the same machine you would enter: svn://localhost/path-to-repos/projectDir.
-
- repository.subversion.anthill.user: This property
stores the username Anthill uses to access the subversion
repository specified in repository.subversion.url.
- anthill.results.email.host: This property contains
the host that Anthill uses to send result emails and in
this case it is also the host where result emails should
be sent. Assuming that you are running James locally you
would enter localhost.
- repository.subversion.anthill.pasword: This
property stores the password that Anthill uses to access
the Subversion repository specified in repository.subversion.url.
- anthill.result.email.password: This property
contains the password for accessing your James email address
- Testing Adapter:
- junit.tests.location: This property stores the
location of your test suite relative to the top level of
your project. So if your test classes are contained in
the test folder you set this property to test.
- junit.tests.suite: This property contains the
name of the class that contains your test suite. This
class can either be a TestCase or define a static suite
method. Package names must be included.
After entering your information, click done.
- You will now return to the main screen where your new project should
show up. To test that everything is set up properly, click the Build link
next to your project. Once the project has completed building you can view
the build report by clicking on the View Report link next to your project.
Developer Information
This section contains information pertinent to those who wish to help with the
development of AHrg. It is divided into two parts. The first part is a guide to
writing an AHrg adapter for the continuous integration tool, testing suite or metric
of your desire. It first takes a brief overview of the structure of AHrg, then
guides the reader through the steps of writing each kind of adapter. The second
part of this section