Adopting Agile Tools & Methods In A Legacy Context

39
Xavier Warzee Email: [email protected] Blog: http://warzee.fr Site: http://www.agilescale.com

description

 

Transcript of Adopting Agile Tools & Methods In A Legacy Context

Page 1: Adopting Agile Tools & Methods In A Legacy Context

Xavier WarzeeEmail: [email protected]

Blog: http://warzee.frSite: http://www.agilescale.com

Page 2: Adopting Agile Tools & Methods In A Legacy Context
Page 3: Adopting Agile Tools & Methods In A Legacy Context

Insurance applications

Talk based on one year engagementIn an insurance companyA subsidiary of one of the largest french bank

6 insurance applicationsUsed by several networks of regional insurance

agenciesRunning in a datacenter (Mainframes, Unix servers)

Page 4: Adopting Agile Tools & Methods In A Legacy Context

Legacy systemsApplications

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

mainframesIBM MQ to communicate with applications

Page 5: Adopting Agile Tools & Methods In A Legacy Context

Tools & practicesBuilding and deployment of J2EE

applications with IBM RAD6 (based on Eclipse 3.0.1)

Software Configuration Managementwith IBM Rational Clearcase LT 2003 for

Java/J2EENothing for Cobol developments

No tests (unit & acceptance tests)

Page 6: Adopting Agile Tools & Methods In A Legacy Context

ObjectivesMain 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” principleShrink time to release new versions of J2EE

applicationsEase deployment of applicationsProvide adapted testing solutions to the legacy

context

Page 7: Adopting Agile Tools & Methods In A Legacy Context

Bottom-up Approach> pragmatic metrics : RTFsMonitor 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 => continuous integration of changes

Page 8: Adopting Agile Tools & Methods In A Legacy Context
Page 9: Adopting Agile Tools & Methods In A Legacy Context

Adoption strategy/audit> Identify steps to improve the developmentNo scripted building

Manual building under RAD6/EclipseCheckout code, check dependencies, package correctly

EAR/WAR1 to 3 days needed to check an application is correctly

packaged !

No scripted deploymentmanual deployment with the Websphere consoleError prone, need to know Websphere Application ServerNeed 1 or 2 days to deploy an application under WAS6.1

No code review to measure quality

And no tests!

Page 10: Adopting Agile Tools & Methods In A Legacy Context

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 deployment!

Page 11: Adopting Agile Tools & Methods In A Legacy Context

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 CruisecontrolContinuous integration of changes (build, unit

tests)Nightly builds (build, tests, deploy & review)Support for pre-release builds (using a Clearcase

label)

Page 12: Adopting Agile Tools & Methods In A Legacy Context

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/FitNessecheck code behaves as expected by users for each

releaseUse FitNesse plugin for RAD/Eclipse and for

MavenPost deployment tests to ensure full testability by

users

Page 13: Adopting Agile Tools & Methods In A Legacy Context

In a legacy context

Page 14: Adopting Agile Tools & Methods In A Legacy Context
Page 15: Adopting Agile Tools & Methods In A Legacy Context

Manual Acceptance

testingUsing the

GUI

Unit Tests

Automated tests ofthe GUI

• Simple• usual approach• manual and error-prone• traceability with requirements?

• Technical solution• Quick to run since automated• numerous similar tests to write• fragile tests (HTML may change)

• What do we test ? Priorities ?• How to identify tests to run ?• How to identify failing tests ?

Start Stop ?Start Stop Look

Mike Cohn tests pyramid adoption>> current practices!

Page 16: Adopting Agile Tools & Methods In A Legacy Context

Acceptance tests with the

GUI

FitNesse

Unit Tests

• Small number of tests• Try automate these tests

• Define accurate functional tests

• Unit tests generalized• Adopt a TDD approach

Start Stop ?Start Stop Look

Mike Cohn tests pyramid adoption> target practices: the pyramid of Mike Cohn

Page 17: Adopting Agile Tools & Methods In A Legacy Context

Mike Cohn tests pyramid adoption> pragmatic target practices!

Unit Tests

Acceptance tests with the

GUI

Automated acceptance

tests

• Try to reduce the number of tests(if any, use FitNesse + Selenium)

• Use Fit/FitNesse

• 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

Page 18: Adopting Agile Tools & Methods In A Legacy Context

DAOBusiness Service

Business Component

Business Component

Business layer (EAR) Mainframe layer

Business

Service

(Cobol)

MQ

DAO

Business Service

MQ

Business Component

Presentation layer

(EAR)

EIARD Application

Application

Process

Service

Business Process

Service

DAS

HTML/JS/JSP

Pages

xml/http mq

Business

Service

(Cobol)

DAS

Page 19: Adopting Agile Tools & Methods In A Legacy Context

Functional testing with FitNesse> Business layer

Black box approachWiki to easy functional data injection!

Dossier component

Personne component

Business layer Mainframe layer

FunctionalService(Cobol)

MQ

DAO

BusinessService

FunctionalService(Cobol)

MQ

ElementStructure component

PMGestionCompteSUT

PMColumnFixture

DAS

DAO

BusinessService

DASPMListeDossiers

SUT

Page 20: Adopting Agile Tools & Methods In A Legacy Context
Page 21: Adopting Agile Tools & Methods In A Legacy Context
Page 22: Adopting Agile Tools & Methods In A Legacy Context
Page 23: Adopting Agile Tools & Methods In A Legacy Context

Selenium is powerfulIssues to set timeout when MQ access not mocked!

(JDBC/DB2)

CADOMDevisA4

Dossier component

Personne component

Business layer Mainframe layer

FunctionalService(Cobol)

MQ

CAD

OM

FunctionalService(Cobol)

MQ

ElementStructure component

Presentation layer

PUPerteMdp PMGestionCompte

SAD

PagesHTML/JS/JSP Request

Other systems

Selenium RC

Functional testing with FitNesse> Presentation layer with Selenium

EIARD application

SeleniumRunner

Page 24: Adopting Agile Tools & Methods In A Legacy Context

Testing scenarios> Car insurance quote scenario Write scenario in natural language with the FitNesse wikiUse 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 !

Page 25: Adopting Agile Tools & Methods In A Legacy Context

FitNesse Tests & Continuous integration 1/3

1

3

Continuous integration server machine

- Windows Service : Selenium-RC

- Windows Service : FitNesse Server (port 9987)

Deployment Platform

SCM repository

(Clearcase, SVN, …)

2

6

4 5

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)5 – Acceptation tests executed using FitNesse

(and Selenium)6 – Notification by email

Page 26: Adopting Agile Tools & Methods In A Legacy Context

FitNesse Tests & Continuous integration 2/3> Maven command called by Cruisecontrol

Definition of a Maven profile: “fitnesse”To declare and configure Fitnesse

pluginTo 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 phaseAfter “package”:

ear applications are deployed to Websphere App Server during this phase !!!

Command to launch FitNesse tests mvn –Pfitnesse post-integration-test

(création du jar)

Page 27: Adopting Agile Tools & Methods In A Legacy Context

FitNesse Tests & Continuous integration 3/3Cruisecontrol 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)

Page 28: Adopting Agile Tools & Methods In A Legacy Context

How to define scenarios? (1/3)Launch an application with Firefox (here e-

IARD)Select Tools -> “Selenium IDE”

Page 29: Adopting Agile Tools & Methods In A Legacy Context

How to define scenarios? (2/3)Complete forms for Car Insurance

Quote (“Simulation Assurance Automobile”)

Events captures by Selenium IDE

Page 30: Adopting Agile Tools & Methods In A Legacy Context

How to define scenarios? (3/3)

FitNesse Page

Page 31: Adopting Agile Tools & Methods In A Legacy Context

Integration ofThe FitNesse report

FitNesse reports> included in the web site generated by Maven

Page 32: Adopting Agile Tools & Methods In A Legacy Context

Eclipse/RAD plugins> Plugin Eclipse FitNesse (Band XI)

Boutons d’accés aux serveurs Fitnesse En local En remote

Page 33: Adopting Agile Tools & Methods In A Legacy Context
Page 34: Adopting Agile Tools & Methods In A Legacy Context
Page 35: Adopting Agile Tools & Methods In A Legacy Context
Page 36: Adopting Agile Tools & Methods In A Legacy Context
Page 37: Adopting Agile Tools & Methods In A Legacy Context
Page 38: Adopting Agile Tools & Methods In A Legacy Context

Incremental releases

Iterative releases

Page 39: Adopting Agile Tools & Methods In A Legacy Context