BDD with Cucumber


BDD stands for Behavior-Driven Development which is a software development process based on Test-Driven Development (TDD). BDD was developed by Dan North as a rethinking approach to the unit testing. He proposes that unit test should be written in order of business value and it should be written in term of scenarios and implemented as classes:

Given [initial context], when [event occurs], then [ensure some outcomes].

Although there are many variants of TDD, however most of them are similar in the way we develop our application: start with the business requirement -> analyze and understand it -> write test cases -> derive application code. This kind of test should be written with the support of tools which allows developer to define the tests in human languages. The main point here is the tests should be easy to understand by business users. Also it helps to provide the ease of connecting the tests with the underlined application code. Cucumber is one of the tools matches above requirements.

Getting start with Cucumber JVM

There are many versions of Cucumber which support many programming languages like Ruby, .NET, Flex, etc.. However, within this post, we only go with Cucumber JVM which allows developer to write test libraries by Java.

Let’s imagine that we need to develop a simple calculator which can support addition and multiply functions.

Continue reading

Heatmap jQuery plugin


Simple jQuery plugin to display the visualization of proportion data corresponding to geometry locations.


Average income
Area Amount
Los Angles


New York





Continue reading

Automated API testing


Today, with the growth of internet, there is lesser web application hosted all its features. Some provide their services, others consume services. So with the need of interaction, API is critical thing. It will help all parties understand each other well and guarantee that the communication happens smoothly.

There are many protocol to carry on the interaction, in which the API is used for communication, such as RMI, SOAP, RESTful, etc.. Among of those, RESTful web service is the hottest one now because of its simplicity and powerful. So the need for API driven or testing API automatically is well recognised.


There are many ways to write a test for RESTful web services, but Frisby proves itself as a simplest way to accomplish the mission. It is a REST API testing framework built on node.js and Jasmine that makes testing API endpoints easy, fast, and fun. Continue reading

Spring Contexts in Web Application


With common Spring MVC web application, there are two levels of application context that an application has. This post will show the difference between those two levels of bean declaration.

Project set up

There are a few empty bean defined for testing purpose: DispatchBean, DuplicatedContextBean, DuplicatedDispatchBean, GlobalBean and MVCBean. They are declared as following spring bean configuration files:

Continue reading

Spring Data versus traditional JPA implementation


Spring Data has come to the market with various support for data access layer such as JPA, JDBC, REST, etc.. It proves itself a robust library which the simplicity but useful. With Spring Data, developers will reduce a significant amount of code to implement the Data Access Objects as usual. It also provides the powerful support for native queries.

The following test is conducted to help JPA developers have a new view of the simpler repository implementations.

Tested Gear

  • CPU: Intel(R) Core(TM) i7-3610QM @2.30 GHz
  • RAM: 8.00 GB @1600 MHz
  • HDD: 500 GB @7200rpm
  • OS: Windows 7 Home Premium

Tested Method

  • Test Creation: Create 10000 records in one transactions.
  • Test Updating: Retrieve each record by id and update a field value of above 10000 records.
  • Test Retrieval: Retrieve each record by its field value.
  • Test Removal: Remove 10000 records in one transactions.


  • JPA implementation: Hibernate as infrastructure and usual DAO implementation. Refer to Generic DAO Implementation.
  • Spring-Data: Hibernate as infrastructure and JPA as ORM.


Continue reading