This document discusses testing strategies for legacy insurance applications at a large French bank. It proposes adopting agile practices like continuous integration, unit testing, and FitNesse acceptance testing. The key steps include using Maven for builds and deployment scripts, code quality tools, CruiseControl for continuous integration, JUnit for unit tests, and FitNesse/Selenium for acceptance tests. This would help modernize testing practices and prepare the applications for future agile development.
3. Insurance applications
Talk based on one year engagement
In an insurance company
A subsidiary of one of the largest french bank
6 insurance applications
Used by several networks of regional insurance
agencies
Running in a datacenter (Mainframes, Unix servers)
4. Legacy systems
Applications
Implemented in Java/J2EE running on Unix
servers
No dependency injection, no cool frameworks
(Spring, Hibernate, …)
Various size and maturity
Business rules and services
Implemented in Cobol running on IBM
mainframes
IBM MQ to communicate with applications
5. Tools & practices
Building and deployment of J2EE
applications
with IBM RAD6 (based on Eclipse 3.0.1)
Software Configuration Management
with IBM Rational Clearcase LT 2003 for
Java/J2EE
Nothing for Cobol developments
No tests (unit & acceptance tests)
6. Objectives
Main objectives
To develop the code really expected for
each release
To prepare adoption of agile methods :-)
Short terms objectives based on the
“follow the pain” principle
Shrink time to release new versions of J2EE
applications
Ease deployment of applications
Provide adapted testing solutions to the legacy
7. Bottom-up Approach
> pragmatic metrics : RTFs
Monitor projects progress with RTFs (Running,
Tested Features)
Running means here deployed to a Websphere
server (we have J2EE applications) =>
continuous deployment
Tested means a development is done when
tested => automated tests during projects
building
Features means make the latest
developments available at any time =>
8.
9. Adoption strategy/audit
> Identify steps to improve the
development
No scripted building
Manual building under RAD6/Eclipse
Checkout code, check dependencies, package correctly
EAR/WAR
1 to 3 days needed to check an application is correctly
packaged !
No scripted deployment
manual deployment with the Websphere console
Error prone, need to know Websphere Application Server
Need 1 or 2 days to deploy an application under WAS6.1
No code review to measure quality
10. Adoption plan proposed
(1/3)
Use Maven to build applications/projects
No longer use an IDE to build apps/projects
(error prone)
Better traceability of packaged components
Develop scripts to deploy applications
Jython Scripts used both by production and
development teams to deploy to Websphere
AS 6.1
Avoid behavior gaps between dev and prod
environments
Scripts called from Maven to automate
11. Adoption plan proposed
(2/3)
Review projects with Maven to measure
code quality
Simple declarative approach to configure code
review tools
PMD, Checkstyle, FindBugs Maven plugins!
Integrate code review reporting during nightly
builds
Just simply use the Maven build lifecycle
Implement Builds Management with
Cruisecontrol
Continuous integration of changes (build, unit
12. Adoption plan proposed
(3/3)
Implement unit tests with Junit, XMLUnit and
JMockIt
Check code behaves as expected by developers !
JMockit helps
to disconnect J2EE applications from MAINFRAME
To test in isolation without modifying application codes
(bytecode rewriting)
Use acceptance tests with Fit/FitNesse
check code behaves as expected by users for each
release
Use FitNesse plugin for RAD/Eclipse and for
Maven
Post deployment tests to ensure full testability by
15. Mike Cohn tests pyramid
adoption
>> current practices!
• Simple
Manual
• usual approach
Acceptance
• manual and error-prone
testing
• traceability with requirements?
Using the
GUI
• Technical solution
Automated
• Quick to run since automated
tests of
• numerous similar tests to write
the GUI
• fragile tests (HTML may change)
Unit
Tests
• What do we test ? Priorities ?
• How to identify tests to run ?
• How to identify failing tests ?
Start Stop Look
Start Stop ?
16. Mike Cohn tests pyramid adoption
> target practices: the pyramid of Mike Cohn
• Small number of tests
• Try automate these tests
Acceptance
tests with the
GUI
• Define accurate functional tests
FitNesse
• Unit tests generalized
• Adopt a TDD approach
Unit Tests
Start Stop Look
Start Stop ?
17. Mike Cohn tests pyramid
adoption
> pragmatic target practices!
Acceptance
• Try to reduce the number of tests
tests with the
GUI
(if any, use FitNesse + Selenium)
Automated
acceptance
• Use Fit/FitNesse
tests
Unit Tests • reach a high coverage of code
• improve capacities of test with
supporting tools (xUnit tools such as
JMockIt, DbUnit, XMLUnit, JUnitPerf,
JsUnit, …)
Start Stop Look
18. Presentation layer Mainframe layer
Business layer (EAR)
(EAR)
Business Component
Business
MQ
DAS Service
(Cobol)
DAO
Business Service
EIARD Application
Business
Business Component
DAS Service
MQ
Application DAO
Business Process (Cobol)
Process
Service
Service
HTML/JS/JSP
Business Service
Pages
Business Component
xml/http mq
19. Functional testing with FitNesse
> Business layer
Black box approach
Wiki to easy functional data injection!
Mainframe layer
Business layer
Dossier component
DAO DAS Functional
MQ
PMListeDossiers Service
SUT (Cobol)
Business
Service
PMColumnFixture
Personne component
Functional
DAO DAS MQ
Service
PMGestionCompte
(Cobol)
SUT
Business
Service
ElementStructure component
20.
21.
22.
23. Functional testing with FitNesse
> Presentation layer with Selenium
Selenium is powerful
Issues to set timeout when MQ access not mocked!
(JDBC/DB2) layer Mainframe layer
Business layer
Presentation
Dossier component
Functional
MQ Service
SAD
(Cobol)
OM CAD
DevisA4
SeleniumRunner
Personne component
Functional
CAD
MQ Service
PUPerteMdp PMGestionCompte (Cobol)
Selenium RC
Pages
OM
Request
HTML/JS/JSP
EIARD application
ElementStructure component
Other systems
24. Testing scenarios
> Car insurance quote scenario
Write scenario in natural language with the FitNesse wiki
Use the SeleniumRunner fixture to translate natural
languages into Selenium verbs (open, click, select, …)
The SeleniumRunner fixture invokes a Selenium instance
The Selenium instance interacts with the application !
25. FitNesse Tests & Continuous integration
1/3
3
4 5
6
Deployment Platform
Continuous integration server machine
- Windows Service : Selenium-RC
- Windows Service : FitNesse Server (port 9987)
1 2
1 – Check in (restitution)
2 – Projects updated on the continuous
integration server
3 – Projects built :
compilation, application and tests resources
generation, unit tests and components tests
execution, code review,
4 – Projects deployment (when needed : EAR)
SCM repository
5 – Acceptation tests executed using FitNesse
(Clearcase, SVN, …)
(and Selenium)
6 – Notification by email
26. FitNesse Tests & Continuous integration
2/3
> Maven command called by Cruisecontrol
Definition of a Maven profile:
“fitnesse”
To declare and configure Fitnesse
plugin
To set FitNesse parameters to use
Here for the Dossier project:
<fitNesseServerName>s00sic001.ca-pacifica.fr</fitNesseServerName>
<fitNesseServerPort>8081</fitNesseServerPort>
<fitNesseServerPage>TestsAcceptation.TestsNm.TestsDossier</fitNe
sseServerPage>
Select a Maven project phase
After “package”:
ear applications are deployed to
Websphere App Server during this phase !!! (création du jar)
Command to launch FitNesse tests
27. FitNesse Tests & Continuous integration 3/3
Cruisecontrol builds applications with Maven
Maven launches FitNesse tests (if present) after
application deployment
Cruisecontrol webapp adapted to collect FitNesse
results in a new tab !
Adaptation de Cruisecontrol
Ajout d’un onglet Fit (FitNesse est la surcouche
Wiki à Fit)
28. How to define scenarios? (1/3)
Launch an application with Firefox (here e-
IARD)
Select Tools -> “Selenium IDE”
29. How to define scenarios? (2/3)
Complete forms for Car Insurance
Quote (“Simulation Assurance
Automobile”)
Events captures by Selenium IDE