Está en la página 1de 39

Xavier Warzee

Email: xavier@warzee.fr
Blog: http://warzee.fr
Site: http://www.agilescale.com
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)
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
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)


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
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 =>
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


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
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
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
In a legacy context
Mike Cohn tests pyramid
adoption
>> current practices!
Manual • Simple
Acceptance • usual approach
testing • manual and error-prone
Using the • traceability with requirements?
GUI
• Technical solution
Automated
• Quick to run since automated
tests of
the GUI • numerous similar tests to write
• fragile tests (HTML may change)
Unit
Tests
• What do we test ? Priorities ?
• How to identify tests to run ?
• How to identify failing tests ?

Start
Start Stop
Stop Look
?
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


Unit Tests • Adopt a TDD approach

Start
Start Stop
Stop Look
?
Mike Cohn tests pyramid
adoption
> pragmatic target practices!

Acceptance
tests with the • Try to reduce the number of tests
GUI
(if any, use FitNesse + Selenium)
Automated
acceptance
tests • Use Fit/FitNesse

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


Presentation layer Business layer (EAR) Mainframe layer
(EAR)
Business Component
Business
MQ
DAS Service
(Cobol)

Business Service DAO

EIARD Application
Business Component Business
DAS MQ Service
Application DAO
Business Process (Cobol)
Process
Service
Service
HTML/JS/JSP
Pages Business Service

Business Component

xml/http mq
Functional testing with FitNesse
> Business layer
Black box approach
Wiki to easy functional data injection!
Business layer Mainframe layer

Dossier component
DAO DAS Functional
PMListeDossiers MQ
Service
SUT (Cobol)

Business
PMColumnFixture Service

Personne component
DAO DAS Functional
MQ
PMGestionCompte Service
SUT (Cobol)

Business
Service

ElementStructure component
Functional testing with FitNesse
> Presentation layer with Selenium
 Selenium is powerful
 Issues to set timeout when MQ access not mocked!
(JDBC/DB2)
Presentation layer Business layer Mainframe layer

Dossier component
Functional
SAD MQ Service
(Cobol)

OM CAD
DevisA4

SeleniumRunner
Personne component
Functional
CAD
MQ Service
PUPerteMdp PMGestionCompte (Cobol)
Selenium RC

Pages
OM
HTML/JS/JSP Request

EIARD application
ElementStructure component

Other systems
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 !
FitNesse Tests & Continuous integration
1/3
3

4 5
6

Continuous integration server machine Deployment Platform


- 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,
SCM repository 4 – Projects deployment (when needed : EAR)
5 – Acceptation tests executed using FitNesse
(Clearcase, SVN, …)
(and Selenium)
6 – Notification by email
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


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)
How to define scenarios? (1/3)
Launch an application with Firefox (here e-
IARD)
Select Tools -> “Selenium IDE”
How to define scenarios? (2/3)
 Complete forms for Car Insurance
Quote (“Simulation Assurance
Automobile”)
 Events captures by Selenium IDE
How to define scenarios? (3/3)
 FitNesse
Page
FitNesse reports
> included in the web site generated by
Maven

Integration of
The FitNesse report
Eclipse/RAD plugins
> Plugin Eclipse FitNesse (Band XI)
Boutons d’accés aux serveurs Fitnesse
 En local
 En remote
Incremental releases

Iterative releases

También podría gustarte