In this article, we will look at how to perform automation testing of JAVA/J2EE applications. Let’s get started.
Generally, J2EE applications are very large and contain several components from the 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 part 1 of this Java application testing series i.e “Overview of Java applications” for more details.
Table of Contents:
How to Perform Automation Testing of JAVA/J2EE Applications
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. Keep testing in mind while 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 of 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:
- Application development with an automated testing tool in mind
- The stage of testing itself.
The flowchart given below depicts the development process with automation testing.
The stages given below describe the automation testing process:
#1) Do an analysis to determine whether Manual and 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 the 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.
For example, for a completely JSP based application, screen navigation tools such as Selenium Webdriver may be sufficient. Note that for JSF based UI applications, in addition to JUnit and Screen navigation testing tools, you may require JSF specific tools to test.
#4) Analyze and decide how many testing stages have to be carried out. If Units, Integrations, Functional/Systems, and Regressions are going to be performed, select the 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 end, 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 to the next article in this series.
2) The complexity of the application – If the application is complex with financial implications for a 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) Time frame for 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) Environmental Support – It is important to select J2EE testing tools based on the environment the application will be running. For example, some run only on Windows, and some are language based.
7) Knowledge of the 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 of 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 a tester much easier. For example, JSF testing tool JSFUnit has provision to test the framework’s classes.
- The efficiency of automated tests is high. For 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.
Conclusion
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 experience with automation testing in the comments section below. You can also post your doubts and queries. We would love to hear from you.
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.
good intro to automation. waiting for tools and frameworks
Good to know about the directions a person may need to think upon while automating the JAVA applications
Good article… waiting for last article on testing JAVA applications series.
this is a good article…..