February 27, 2018

Testing Pyramid

While searching theory behind integration tests, I landed into testing pyramid concept and found it good to be share.
Basically, tests are used as a feedback loop. They are responsible to inform developer whether the application is working or not.

With respect to the testing pyramid, three types of test cases are described.
·        Unit test cases are focused on the single unit of responsibility at a time. All the dependencies of that single unit will be mocked.
·        Integration tests are to ensure that more than one unit working together should work fine without mocking other units.
·        End to end tests or acceptance tests is used to test the application by simulating end user scenarios.

Testing Pyramid

In testing pyramid concept, it always focuses on to write more and more unit test case and business should be tested in form smallest unit.

Integration tests to test integration between units without mocking the units. It will make sure communication between units is working fine as the business logic already tested in unit tests.

With testing pyramid concept, it always discourages to write more end to end test cases as they are slow to run as running against a live application.
Also, it’s not easy to identify which unit is failing. Single change or enhancement in one feature may lead to failure of most of the end to end test like if login feature is changed in an application then the further features test will start failing.
Only advantages of the end to end tests are they are able to simulate end user behavior.

Also from one of google blog, it is also suggested to have 70 (Unit) / 20 (Integration) / 10 (End to end) ratio for tests.

September 19, 2017

How To Check If Column Exists In ResultSet

Below APIs can be used for checking a column name exist is result set or not. Checking of column name can be used only in case if we are not sure about the existence of column in the resultset.In any other case, it always good to directly access.

 * @param resultSet  
 * @param columnName Name of column to be checked
 * @return
 * @throws SQLException
private boolean hasColumn(ResultSet resultSet, String columnName) throws SQLException {
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
int coulmnCount = resultSetMetaData.getColumnCount();
for (int i = 1; i <= coulmnCount; i++) {
if (columnName.equals(resultSetMetaData.getColumnName(i))) {
return true;
return false;

March 7, 2017

Eclipse error | EcoreEMap$DelegateEObjectContainmentEList

Eclipse error

An internal error occurred during: "Loading Web Service DOM..."

Above error I faced while working with one of my eclipse project. After this if I do Ok and continue with eclipse I am getting error with eclipse import project for existing work space and svn checkout.

I tried out many thing and found it is related to Java version. Not sure it is right way to resolve this issue or not, But it worked for me. Java version in eclipse is degraded to 1.5.I don’t know how it took place. So I updated my java version to 1.7 again and this error is solved.

January 2, 2017

Maven | How To Set Specific Java Version

This article is to learn how to set specific java version for maven in windows. As this might be required where java home set to one version and developer want to run maven command with specific another java version.4-l
To run maven with specific java, one need to update file mvn.bat file in bin folder. In mvn.bat file set java home explicitly as below.

set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25\jre
if not "%JAVA_HOME%" == "" goto OkJHome

After saving mvn.bat, maven will run with respect to java home set in file.
One can verify this by firing command mvn command as below.
After setting up Java version in mvn.bat file, maven java version can be verified in command prompt.

C:\Users\e050125>java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

C:\Users\e050125>mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:28+0530)
Maven home: C:\software\Maven\apache-maven-3.0.5
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

January 1, 2017

Cygwin | How To Get C Drive Location

I came across to Cygwin with one of the requirements of my project. Basically, I want to perform some Linux command on windows. After googling out I landed to Cygwin as a solution and found it good to share.
Here below is the command to navigate to C drive of your windows system using Cygwin.

$ cd cygdrive/c 

Here below is the screenshot of what prior command require to execute.