© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.1 5. Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Test process essentials Riitta Viitamäki,
Acceptance Testing.
Extreme Programming Alexander Kanavin Lappeenranta University of Technology.
© S. Demeyer, S. Ducasse, O. Nierstrasz Migration Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow.
Lecture # 2 : Process Models
Chapter 05: Evolutionary Requirements Definition : Requirements  “Requirements are capabilities and conditions to which the system, and more broadly.
SOFTWARE MAINTENANCE 24 March 2013 William W. McMillan.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 17 Slide 1 Rapid software development.
Alternate Software Development Methodologies
© S. Demeyer, S. Ducasse, O. Nierstrasz Reverse Engineering.1 2. Reverse Engineering What and Why Setting Direction  Most Valuable First First Contact.
Object-Oriented Reengineering Oscar Nierstrasz Software Composition Group University of Bern.
1 Software Engineering II Presentation Software Maintenance.
© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.1 5. Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow.
OORPT Object-Oriented Reengineering Patterns and Techniques 10. Testing and Migration Prof. O. Nierstrasz.
The Basics of Software Testing
Notion of a Project Notes from OOSE Slides - modified.
© S. Demeyer, S. Ducasse, O. Nierstrasz Chapter.1 Unit Testing Explained How to support changes? How to support basic but synchronized documentation?
From Inception to Elaboration Chapter 8 Applying UML and Patterns -Craig Larman.
Xtreme Programming. Software Life Cycle The activities that take place between the time software program is first conceived and the time it is finally.
Chapter 11: Testing The dynamic verification of the behavior of a program on a finite set of test cases, suitable selected from the usually infinite execution.
Chapter 9 – Software Evolution and Maintenance
Introduction to RUP Spring Sharif Univ. of Tech.2 Outlines What is RUP? RUP Phases –Inception –Elaboration –Construction –Transition.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
Teaching material for a course in Software Project Management & Software Engineering – part II.
© S. Demeyer, S. Ducasse, O. Nierstrasz Intro.1 1. Introduction Goals Why Reengineering ?  Lehman's Laws  Object-Oriented Legacy Typical Problems  common.
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
Testing Basics of Testing Presented by: Vijay.C.G – Glister Tech.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 1: Software and Software Engineering.
Lecture 19 Chapter 10 A Portfolio Approach to Managing IT Projects.
Software Engineering Principles Principles form the basis of methods, techniques, methodologies and tools Principles form the basis of methods, techniques,
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
Rapid software development 1. Topics covered Agile methods Extreme programming Rapid application development Software prototyping 2.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 1: Software and Software Engineering.
T Iteration demo T Iteration Demo Team Balboa I1 - Iteration
Rational Unified Process (RUP) Process Meta-model Inception Phase These notes adopted and slightly modified from “RUP Made Easy”, provided by the IBM Academic.
1 Legacy Code From Feathers, Ch 2 Steve Chenoweth, RHIT Right – Your basic Legacy, from Subaru, starting at $ 20,295, 24 city, 32 highway.
Software from Requirements Brent Haines April 12, 2007 Why Methodology Doesn’t Really Matter.
PROC-1 1. Software Development Process. PROC-2 A Process Software Development Process User’s Requirements Software System Unified Process: Component Based.
The Software Development Process
CS5103 Software Engineering Lecture 02 More on Software Process Models.
Lecture 4 – XP and Agile 17/9/15. Plan-driven and agile development Plan-driven development A plan-driven approach to software engineering is based around.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Software Engineering Prof. Dr. Bertrand Meyer Dr. Manuel Oriol Dr. Bernd Schoeller Chair of Software Engineering Lectures 22: Legacy Software.
Requirements Engineering Requirements Engineering in Agile Methods Lecture-28.
CSC 480 Software Engineering Test Planning. Test Cases and Test Plans A test case is an explicit set of instructions designed to detect a particular class.
Compuware Corporation Deliver Reliable Applications Faster Dave Kapelanski Automated Testing Manager.
(1) Test Driven Development Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Software Engineering Principles Practical Advice and Steps for Managing Your Project.
Process Asad Ur Rehman Chief Technology Officer Feditec Enterprise.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Software Development Process CS 360 Lecture 3. Software Process The software process is a structured set of activities required to develop a software.
A framework that describes the activities performed at each stage of a software development project. A life-cycle or a software process is the organisational.
CS223: Software Engineering Lecture 32: Software Maintenance.
Chapter 25 – Configuration Management 1Chapter 25 Configuration management.
Continuous Delivery and Quality Monitoring 1 iCSC2016, Kamil Henryk Król, CERN Continuous Delivery and Quality Monitoring Kamil Henryk Król CERN Inverted.
Software Configuration Management
Chapter 18 Maintaining Information Systems
Managing the System PPT SOURCE : Shari L. Pfleeger Joann M. Atlee.
Smart Testing and Recycling Testing
Applied Software Implementation & Testing
Lecture 09:Software Testing
Chapter 2 – Software Processes
Testing and Test-Driven Development CSC 4700 Software Engineering
Software Testing and Maintenance Maintenance and Evolution Overview
Chapter 8 Software Evolution.
System Reengineering Restructuring or rewriting part or all of a system without changing its functionality Applicable when some (but not all) subsystems.
Test Cases, Test Suites and Test Case management systems
Overview Activities from additional UP disciplines are needed to bring a system into being Implementation Testing Deployment Configuration and change management.
Presentation transcript:

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.1 5. Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow Your Test Base Incrementally  Use a Testing Framework  Record Business Rules as Tests  … Migration Strategies  Make a Bridge to the New Town Conclusion

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.2 What and Why ? Definitions Restructuring refers to transforming a system from one representation to another while remaining at the same abstraction level.— Chikofsky & Cross, ’90 Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure— Fowler, ’99 Motivation Alter the source-code to  solve problems identified earlier  without introducing new defects  and while the system remains in operation

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.3 The Reengineering Life-Cycle Requirements Designs Code (0) requirement analysis (1) model capture (2) problem detection (3) problem resolution (4) program transformation (3) problem resolution (4) program transformation issues reliability time risk

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.4 Roadmap What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow Your Test Base Incrementally  Use a Testing Framework  Record Business Rules as Tests  … Migration Strategies  Make a Bridge to the New Town Conclusion

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.5 Forces — Testing Many legacy systems don’t have tests Software changes introduce new bugs You can’t test everything Concurrency and user interfaces are hard to test Testing is usually everyone’s lowest priority Knowledge concentration poses high risk Customers pay for features, not tests Customers don’t want buggy systems Good programmers don’t need tests New tools and techniques are more fun than testing Testing is akin to street-cleaning

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.6 Tests: Your Life Insurance! Write Tests to Enable Evolution Grow Your Test Base Incrementally Manage tests Use a Testing Framework Test the Interface, Not the Implementation Record Business Rules as Tests Design tests Test Fuzzy features Test Old Bugs Retest Persistent Problems Write Tests to Understand Regression Test after Every Change Migration Strategies

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.7 Write Tests to Enable Evolution Problem: How do you minimize the risks of change? Solution: Introduce automated, repeatable, stored tests Automated Tests System ConfidenceTurnover Risk minimization System documentationArchitectural evolution Long-term evolution Automated tests are the foundation of reengineering Confidence in Change

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.8 Grow Your Test Base Incrementally Problem: When can you stop writing tests? Solution: When your tests cover all the code! … however  you're paid to reengineer, not to write tests  testing ALL the code is impossible  design documentation is out-of date » semi-automated black-box testing is not an option Answer: Grow Your Test Base Incrementally -first test critical components (business value; likely to change; …) -keep a snapshot of old system (run new tests against old system) -focus on business values -test old bugs + new bugs that are reported

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.9 Use a Testing Framework Problem: How do you encourage systematic testing? Solution: Use a framework to structure your tests

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.10 Running tests

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.11 Test the Interface, Not the Implementation Problem: How do you protect your investment in tests? Solution: Apply black-box testing Test interfaces, not implementations  Be sure to exercise the boundaries Test scenarios, not paths  Use tools to check for coverage Beware;  Enabling testing will influence your design!

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.12 Write Tests to Understand Problem: How to decipher code without adequate tests or documentation? Solution: Encode your hypotheses as test cases Exercise the code Formalize your reverse-engineering hypotheses Develop tests as a by-product

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.13 Record Business Rules as Tests Problem: How do you keep your system in sync with the business rules it implements? A Solution: Good documentation + Good design … however  business rules are too complex to design well  documentation & design degrades when the rules change  business rules become implicit in code and minds Solution: Record Business Rules as Tests -canonical examples exist -can be turned into input/output tests

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.14 Example: Payroll Business Rule A person or couple gets an amount of money for every child he, she or they raise. Basically parents get CHF 150,- per month for every child younger than 12 years, and CHF 180,- for every child between 12 and 18 and for every child between 18 and 25 as long as the child is not working and is still in the educational system. A single parent gets the full 100% of this money as long as he or she is working more than 50%. Couples get a percentage of the money that is equal to the summed working percentages of both partners.

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.15 Example: Payroll Test Case "--- input-cases are extracted from a database" singlePerson80WithOneKidOf5 := extract.... couplePerson40occupationWithOneKidOf5 := extract.... couplePerson100occupationWithOneKidOf5 := extract.... couplePersonWithOneKidOf14 := extract.... "--- tests compare expected output against actual output" self assert: singlePerson80occupationWithOneKidOf5 moneyForKid = 150. self assert: couplePerson40occupationWithOneKidOf5 moneyForKid = 150*4. self assert: couplePerson100occupationWith2KidsOf5 moneyForKid = 150*2. self assert: couplePersonWithOneKidOf14 moneyForKid = 180.

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.16 Other patterns Retest Persistent Problems  Always tests these, even if you are making no changes to this part of the system Test Fuzzy Features  Identify and write tests for ambiguous or ill-defined parts of the system Test Old Bugs  Examine old problems reports, especially since the last stable release — DeLano and Rising, 1998

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.17 Roadmap What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow Your Test Base Incrementally  Use a Testing Framework  Record Business Rules as Tests  … Migration Strategies  Make a Bridge to the New Town Conclusion

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.18 The Reengineering Life-Cycle Requirements Designs Code (0) requirement analysis (1) model capture (2) problem detection (3) problem resolution (4) program transformation (3) problem resolution (4) program transformation issues reliability time risk

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.19 Forces — Migration Big-bang migration often fails Users hate change You need constant feedback to stay on track Users just want to get their work done The legacy data must be available during the transition

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.20 Migration Strategies Migrate Systems Incrementally Conserve Familiarity How Use Profiler before Optimizing Build Confidence Involve the Users How Why Present the Right Interface Deprecate Obsolete Interfaces Distinguish Public from Published Interfaces Make a Bridge to the New Town Always Have a Running Version Regression Test after Every Change How Tests, your Life-Insurance Prototype the Target Solution Where to

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.21 Involve the Users Problem: How to get users to accept change? Solution: Get them involved by giving them what they want Start with the Most Valuable First Prototypes can help raise enthusiasm, but may also raise expectations too high Deploy early to increase commitment  Diverts energy from development  Pays back in quality feedback

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.22 Build Confidence Problem: How do you overcome skepticism? Solution: Deliver results in short, regular intervals Requires time to sync with users Requires effort to support the changes Requires care not to alienate original developers Requires regular, big demos to convince management

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.23 Migrate Systems Incrementally Problem: When should you deploy the new system? Solution: As soon as possible Decompose the legacy system into parts Tackle one part at a time (Most Valuable First) Put suitable tests in place Decide whether to wrap, reengineer, or replace Deploy, support and obtain feedback Iterate

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.24 Prototype the Target Solution Problem: How do you evaluate the target solution? Solution: Develop a prototype Evaluate the technical risks  New system architecture  Migrating legacy data  Adequate performance … Exploratory prototype?  Explore specific issues, then throw it away! Evolutionary prototype?  Capture new architecture  Migrate, wrap, reengineer or reimplement parts

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.25 Always Have a Running Version Problem: Maintaining confidence during development Solution: Integrate changes on a daily basis Use version and configuration management tools Maintain exhaustive regression tests where needed Plan short iterations — Continuous Integration  If necessary, re-architect the system to enable short build times

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.26 Regression Test After Every Change Problem: Making sure changes don’t break the system Solution: Run the regression tests at each “stable” point You must relentlessly write tests!  Write new tests whenever new (untested) bugs are discovered  Take time to convince your team of the Joy of Testing If testing takes too long, categorize tests  But run all the tests at least once a day Consider writing tests up front Remember to Retest Persistent Problems

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.27 Make a Bridge to the New Town Problem: How to migrate data? Solution: Convert the underlying files/databases/…... however  Legacy and new system must work in tandem  Too much data; too many unknown dependencies  Data is manipulated by components Bridge 1:read()2:write() 1.1:read() 1.2:write()2.1:write() Legacy System New System Data Store

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.28 Present the Right Interface Problem: How do you prevent the legacy design from polluting the new system? Solution: Wrap old services as new abstractions Identify the new abstractions you want Wrap the legacy services to emulate the new interface  Avoid directly accessing old procedural interfaces  Avoid wrapping as pseudo-OO «utility» classes

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.29 Public vs. Published Interface Problem: How to design interface for target solution? Solution?: Think deeply... however  Enable migration to target system ASAP  Avoid freezing the interface of target component  Costly ripple-effects of changes to public interface Solution: Distinguish between "public" and "published" interface -"public" = stable target interface -"published" = available, but unstable (use at your own risk) -language features (protected, friends, …) -naming conventions

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.30 Deprecate Obsolete Interfaces Problem: How to modify an interface without invalidating all clients? Solution: Flag the old interface as «deprecated» Old and new interfaces can co-exist for a time  Deprecated usage can be lazily patched Various techniques possible  Documentation (easy to ignore)  Move or rename old interfaces (painful)  Add warnings to deprecated code (should be non- intrusive)

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.31 Conserve Familiarity Problem: How to avoid disrupting Users’ work? Solution: Avoid radical changes Avoid alienating users Introduce a constant, small number of changes with each release

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.32 Use Profiler Before Optimizing Problem: When should you rewrite inefficient code? Solution: Only when you have benchmarks that prove it is worthwhile “Do it, then do it right, then do it fast”

© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.33 Conclusion Avoid risk  small increments ("chicken little")  develop suite of regression tests … at acceptable cost  Migration costs as much as new development !  But you avoid "hidden costs" team morale in maintenance team satisfying two customer bases