More and more companies are now using Agile as their development methodology. This requires that test cases be executed, completed in a short time, and repeated very often. To reach these objectives, automated testing is a must.

There are many ways to setup your automated testing system. The purpose of this blog is not to compare and conclude which one is the best; but mainly to show an example of creating and executing JSAS test automation, one of the automation platforms that we’ve been using lately.

First, what’s “JSAS”? In this blog, it means:

JJenkins, previously called “Hudson”, a well-known free CI (Continuous Integration) system that can be setup in 10 minutes. (Cool! Isn’t it?) We use it to schedule what time to run which automation scripts.

SSubversion, the version control tool used to manage your code. Jenkins will check the code to be executed from Subversion server automatically.

A – Apache Ant, a Java library and command-line tool whose mission is to drive processes. In short, Jenkins naturally uses ANT to run the automation scripts after checking them out from Subversion.

SSelenium, providing the API to write automation scripts. An example is shown below.

For our example, let’s say you want to run the following simple test case at 9 PM every day automatically.

  1. 1.        Invoke browser.
  2. 2.       Navigate to
  3. 3.       Input “iPhone” in the search field.
  4. 4.       Click Go button.

Here is the whole lifecycle from beginning (creating the automation script) to the end (reading the final test result).

1: Write automation script with Selenium API

In this example, we developed the script with JAVA, using the Eclipse IDE.

For your convenience, the code is shown below:


[code lang=”java”]package com.test.Amazon;

import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

public class AmazonTest {

private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = “”;
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

public void testAmazon() throws Exception {
driver.get(baseUrl + “/”);

public void tearDown() throws Exception {
String verificationErrorString = verificationErrors.toString();
if (!””.equals(verificationErrorString)) {


2:Create ANT build file

We’ve created the automation script. The next step is to execute it.

As mentioned previously, we use ANT to drive the automation. To use ANT, we must create a build file (build.xml) and put it into the Java project’s root folder.Here’s the file:


[code lang=”xml”]



3: Check code into Subversion server

Next, we need check the script into Subversion.  In Jenkins, once a job is executed, the first thing it does is to check code out from Subversion. After checking out the code, Jenkins will start to run the code..

The address of the SVN server is:


4: Create a job in Jenkins

Now, we have the script, ANT build file, and checked all into Subversion. The last step is to create a job in Jenkins to run the test case at 9 PM every day.

The name of our Jenkins job is “Amazon Test”.


More detailed settings in the job:

  1. Job Name: Amazon Test
  2. Source Code Management: (this is where we checked in the code)
  3. Build Triggers: 0 21 * * * (it means this taskwill be executed at 9 PM sharp everyday.)
  4. Add Build Step: Invoke Ant (so that ANT can run the automation script –
  5. Post Build Action: Publish JUnit test result report > Test report xml: report/TEST-*.xml


5. Run the job

Now we can wait until 9 PM for the script to be run. Let’s run it manually and see what will happen.

The job is running …


6. Check the result

Job is completed. The result page.


More result details.


The result trend of the job after running multiple times. We can see that there was 1 automation script executed and it failed at the 6th build. When you have more scripts and lots of build results, this graph shows the overall percentage of pass/fail and can provide a good indication of the build’s stabilization.


We’ve went through all the stepson creating, executing and getting results for JSAS test automation. The only step left is fixing defect(s) that are found and then re-executing the script.

It’s easy to use “JSAS”. Scheduling the tasks, reading the results, and checking the history in Jenkins are also very easy. In fact, you also can run automation scripts on multiple machines at the same time. In addition to Ant, Jenkins supports other version control tools like Git and Maven. It also has many of plug-ins that supports integration with the tools including TestLink, Jira, Xcode, and databases etc.

For Selenium, you can use other programming languages like Ruby or C# if your company is not using Java. One important thing to note is: Selenium is designed for web-based applications. If your application is not web-based, please consider other tool to replace Selenium in this system.

Lastly, all stuff in “JSAS” are free. This saves you time and the cost of developing your own system and their versions are frequently updated so you needn’t worry about the maintenance and supporting of the latest techniques.

I hope this blog was helpful for extending your ideas of implementing JSAS test automation. Will you use it in your company soon?