Saturday 1 March 2014

Unit Testing a Customized Application Block

Application blocks may need to be customized based on the requirements of the application. After the application block is customized, it must be unit tested to make sure that the customizations do not break the functionality of existing features. Unit testing also ensures that the customizations are in accordance with the requirements of the application that the block is to be integrated with.
For example, in the case of the online bookstore sample application, the CMAB is required to read and write configuration data to and from an Oracle data store. Therefore, the CMAB has to be customized to manage configuration data stored in an Oracle database. The unit testing is based on the process described in Chapter 3, "Testing Process for Application Blocks."
The following are required for planning the unit tests for the customized application block:
  • Requirements and functional specifications for the CMAB and the customizations to be made to the CMAB.
  • Performance targets for the sample application use cases using the CMAB.
  • Deployment architecture for the sample application.
The unit testing process for the CMAB includes the following steps:
  1. Create test plans.
  2. Review the design.
  3. Review the implementation.
  4. Perform black box testing.
  5. Perform white box testing.
  6. Regression test the existing functionality.


Integration Testing an Application Block

Integration testing is the logical extension of unit testing. You may be using the application block as packaged, or you may have customized it before integrating it in your application. In either case, you need to conduct integration testing to ensure that the application block can meet the application-specific requirements. Integration testing ensures the following:
  • The interfaces between the integrated units of the application and the application block are able to interact in accordance with the specifications.
  • The modules of the application with which the application block has been integrated meet all of the functional requirements, performance objectives, globalization objectives, security objectives, and so on.
Integration testing is important because a piece of code that functions correctly when it is tested as a separate unit can demonstrate problems when it is integrated into the actual application. For example, an incompatible data type could be provided by the application to the application block, or data storage could be locked by some part of the application. In the worst scenario, you may discover issues such as the application block being unable to meet the performance objectives of the application or a loss of data at particular times, such as when the block passes decimals with accuracy to 10 digits of the decimal.
However, in most situations you will discover issues such as improper invocation of the interfaces exposed by the application block, missing error handling, failure to trap all of the exceptions thrown by the application block, incorrect data in configuration files, or mismatch of data types leading to loss of data. The majority of the errors that are discovered during the integration phase of the application block occur at the interface between the application block and the application.
Note that the integration testing of the application block is part of the overall testing process for the application itself. The application may also be integrating the other modules, and the following process is not a substitute for any other kind of testing that needs to be done for the application. The following process focuses on testing the integration of the application block with the application.
For the purposes of illustration, the CMAB is assumed to be integrated with the sample application, which requires configuration data to be stored in an Oracle database. Therefore, a custom storage provider has to be added to the CMAB for reading and writing configuration data from and to an Oracle database. The sample application allows users to personalize the Web site and order a book online.

Input for Integration Testing

The following are required for integration testing of an application block:
  • Functional specifications of the online bookstore sample application and application block
  • Requirements for the sample application and application block
  • Performance objectives for the sample application
  • Deployment scenarios for the sample application

Steps for Integration Testing

The integration testing process for an application block is shown in Figure 9.2.
Ff649495.f09mtf02(en-us,PandP.10).gif

0 comments :

Post a Comment