How to Perform Automation Testing of JAVA/J2EE Applications (Part 2)

Generally, J2EE applications are very large and contain several components from front-end screen to back-end database. Automated testing is preferred over manual testing for such large applications due to time and effort saved. Automated testing is typically done with the help of tools and frameworks.

A J2EE application contains several components; please refer to the part 1 of this Java application testing series i.e “Overview of Java applications” for more details.

automated testing JAVA applications

As an overview: JSP is the view component or screen. JSF is a view component framework. JavaScript is used for screen validation. Servlet, Framework, EJB, Bean and other Java classes are used for writing business logic.

Automated testing may be done with one tool or a combination of tools for each Java component. Please note that application testing may not be completely automated. The decision to automate depends on the size and complexity of the application, and preferences of the developer, tester, and architect. Keeping testing in mind, when writing applications will make the process smoother for the team and produce a quality end product that meets the high expectations of the customer.

Stages in Automated Testing Process:

For effective automated testing, the testing approach needs to be given detailed thought before the development of the application. There are two separate processes:

  1. Application development with the automated testing tool in mind
  2. The stages of testing itself.

The flowchart below depicts the development process with automation testing.

Automated Testing of J2EE Application

The below stages describe the automation testing process:

#1) Do an analysis to determine whether Manual or Automation testing should be carried out. Also, analyze which part/s of testing in the application should be automated and which should be manual.

#2) Once there is a scope or requirement for Automation testing, do a feasibility analysis.

#3) Decide and select an appropriate tool. Once the components involved in the J2EE application are known and the complexity of the application is understood, one or more tools as needed may be chosen for testing.

Example, for a completely JSP based application screen navigation tool such as Selenium Webdriver may be sufficient. Note that for JSF based UI application, in addition to JUnit and Screen navigation testing tools, you may require JSF specific tools to test.

#4) Analyze and decide how many stages in testing need to be carried out. If Unit, Integration, Functional/System, and Regressions are going to be performed, select appropriate tool for each stage.

#5) Analyze the impact of the testing tool on the design of an application. If testing is going to be automated, it is important to develop applications keeping the tool in mind.

#6) Develop a pilot or a model application, run the tool and check that the tool adds the value estimated during the analysis phase. If this step goes as planned, the tool can be finalized for the application.

#7) Once the application is ready to be tested, write test scripts and run the tool.

Tool Selection

Selecting the appropriate automation testing tool for a J2EE application largely depends on the type of application and the technologies used. Apart from this, there are several other factors that affect tool selection:

1) Type of application – A J2EE application can have many variations. Some are developed with frameworks such as Struts, Spring, Hibernate, some use only Server Side technologies (JSP, Servlets), while other applications are built end to ends, such as view components, controller, business logic, and database.

One or more tools may be chosen as per the technologies used. For J2EE component-wise tools available, please refer the next article in this series.

2) The complexity of application – If the application is complex with financial implications fora large set of users, testing needs to be done on a detailed level with appropriate tools.

If the application is simple, such as a display of reports and data with only a few users, testing can be done with simple open source tools.

3) Type of testing – A unit testing tool may not work well for Integration testing and vice versa. For example, JUnit is a popular tool for Unit Testing, but TestNG is used for Integration testing.

4) The budget of testing – Many of the popular tools are open source, so they fit most projects. For technology specific tools, the team may be required to check whether tool cost is acceptable.

5) The time frame of testing – As in most application developments, deadlines are tight. Some tools may require more time than others for learning, environment setup, and writing test cases.

6) Environment Support – It is important to select J2EE testing tools based on the environment the application would be running. For example, some run only on Windows, and some are language based.

7) Knowledge of tester – The tester may be familiar with and experienced in a particular tool. If your project requirements and the tester’s knowledge match, that tool can be selected to save time on training.

8) Compatibility with other testing frameworks – In large J2EE applications, when several components such as JSP, Servlets, JavaScript, JSP, EJB, and Database are used, one tool will not work for all.

Therefore, the testing frameworks chosen should be able to accommodate other frameworks.

9) Display of test results and statistics – For most projects, test readability can form important criteria. Thus, it may become important for the test execution results to be displayed in a proper screen format with defect list, reasons, etc.

Advantages of Automated Testing of J2EE Applications

  • J2EE applications are normally large; manual testing the entire application may prove to be very time consuming and error-prone.
  • Several J2EE automated testing tools come with basic functionality testing features. They are developed and designed keeping the component in mind. This makes the life of tester much easier. For example, a JSF testing tool JSFUnit has provision to test the framework’s classes.
  • The efficiency of automated tests is high. In Manual testing, correctness depends on the skill of the tester.
  • In projects where repetitive changes occur and testing of the same code is required to be done several times, automated testing proves beneficial.
  • Automated testing covers a larger set of test case executions. As this type of testing is not human dependent, the speed of execution is fast and a larger set can be covered in a short time.
  • As intervention by the tester is not required, for the most part, test results are more accurate than manual testing. The testing process is also consistent.


Automated testing is preferred for large J2EE applications. Testing an application may not be fully automated. Manual and automated testing go hand in hand. While initially learning and setting up the tool may prove time-consuming, once the process is established, testing is more efficient.

In the next article, we will see a comprehensive list of popular J2EE component-wise testing tools and frameworks.

Let us know your automation testing experience and queries.

Recommended Reading

6 thoughts on “How to Perform Automation Testing of JAVA/J2EE Applications (Part 2)”

  1. Good article… waiting for last article on testing JAVA applications series.

  2. good intro to automation. waiting for tools and frameworks

  3. Good to know about the directions a person may need to think upon while automating the JAVA applications

  4. this is a good article…..

  5. J2EE is long gone, my friend.

    • J2EE is not gone anywhere. All the newer frameworks are built upon it. I bet if any one invented the alternative for J2EE; Though the .net is closer but never been successful. Let me know if you need any help on understanding of it.


Leave a Comment