Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Unit test Struts applications with mock objects and AOP

Test-driven development improves software quality while reducing development efforts.

Tutorial Details:

As the foundation of an overall test strategy, unit tests must be comprehensive, easy to set up, and quick to execute. However, the dependency on the execution environment and on code outside the class under test complicates our ability to achieve these goals. Deploying the application in a container significantly slows down the code-and-test cycle. Furthermore, the need to collaborate with other classes usually leads to more complex test setups and slower test runs.

The Integration need
Non-trivial Struts applications exhibit both execution environment and class dependencies because Struts actions execute in a servlet container and typically call other classes to process the requests. The mock object testing approach helps remove the unwanted dependencies. The StrutsTestCase testing framework provides a mock implementation of the servlet container with the MockStrutsTestCase class that extends the base JUnit test case. It facilitates out-container testing that speeds up unit testing cycles. EasyMock, another testing framework, makes it easy to dynamically mock the collaborating classes. The mocks substitute real classes with simpler implementations and add verification logic to support unit testing.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Unit test Struts applications with mock objects and AOP

View Tutorial:
Unit test Struts applications with mock objects and AOP

Related Tutorials:

Test infect your Enterprise JavaBeans - JavaWorld May 2000
Test infect your Enterprise JavaBeans - JavaWorld May 2000
 
Boost Struts with
Boost Struts with XSLT and XML
 
I want my AOP!, Part 3
I want my AOP!, Part 3
 
Mix protocols transparently in Struts
Mix protocols transparently in Struts
 
Take command of your software
Take command of your software
 
Rumble in the jungle: J2EE versus .Net, Part 2
Rumble in the jungle: J2EE versus .Net, Part 2
 
Jump the hurdles of Struts development
Jump the hurdles of Struts development
 
Excellent tutorial on Struts and Tiles
Excellent tutorial on Struts and Tiles This tutorial assumes knowledge of Java, JDBC, Servlets, J2EE (with regards to Web applications) and JSP Struts in a holistic manner, minus the beads and crystals. The Tiles framework makes creating reusable pages
 
Use AOP to maintain legacy Java applications
Use AOP to maintain legacy Java applications This artical shows you how to use aspect-oriented programming (AOP) to gain an unprecedented view into the inner workings of even the most opaque of legacy applications. Please note that this article assume
 
Object-relation mapping without the container
If you follow the latest developer buzz then you\\\\\'ve likely heard of IOC (Inversion of Control) containers and AOP (aspect-oriented programming).
 
Performance Analysis of J2EE Applications Using AOP Techniques
Performance Analysis of J2EE Applications Using AOP Techniques In this article we demonstrate the use of AOP techniques through which J2EE applications can be easily instrumented without any modifications to application code. We have developed a very sim
 
Second-generation aspect-oriented programming
Second-generation aspect-oriented programming
 
Martin Fowler\'s usual terrific writing
The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. However the term mock was not originally meant as a more catchy name for stub, but to introduce a different approach to unit testing. In
 
jGuard v0.60 released!
jGuard v0.60 released! i am pleased to announce a new major release(v0.60) of the java security library called jGuard(http://sourceforge.net/projects/jguard/). this library is build on top of jaas, for J2EE web applications. his goal is to provide f
 
Automate GUI tests for Swing applications
Summary Automation is necessary for frequent and consistent testing, which is the foundation of agile development. However, acceptance tests of GUI applications are not always easy to automate. This article explains a simple way of automating Java Swing
 
Struts and Tiles aid component-based development
In the Java world, Struts is one of the best-known and most talked about open source embodiments of MVC.
 
Mock Objects in Unit Tests
EasyMock is a well-known mock tool that can create a mock object for a given interface at runtime.
 
Beginner to advance guide to the Apache Struts
Beginner to advance guide to the Apache Struts The Complete Apache Struts Tutorial This complete reference of Jakarta Struts shows you how to develop Struts applications using ant and deploy on the JBoss Application Server. Ant script is provided
 
Struts Guide
Struts Guide Struts Guide This tutorial is extensive guide to the Struts Framework. In this tutorial you will learn how to develop robust application using Jakarta Struts Framework. This tutorial assumes that the reader is familiar with the web
 
Developing Simple Struts Tiles Application
Developing Simple Struts Tiles Application Developing Simple Struts Tiles Application Introduction In this section I will show you how to develop simple Struts Tiles Application. You will learn how to setup the Struts Tiles and create example
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.