SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
basistechnologies.com
A Basis Technologies white paperA Basis Technologies white paper
basistechnologies.com
Unit Test Automation
A step towards Agile delivery
and DevOps in SAP
basistechnologies.com
Digital changes everything
A seismic shift in the way companies operate and
engage with customers is occurring. It’s being driven by
a perfect storm of technological development. And it’s
changing everything.
In our previous e-book – 8 steps to daily SAP releases
– we saw that born-digital companies are setting
the pace when it comes to updating their customer
engagement systems. And traditional companies
must transform themselves if they are to compete
successfully.
The same e-book also demonstrated how DevOps – a
software development and deployment methodology
that emphasizes collaboration, communication, mixed
discipline teams and, very importantly, automation
– can be successfully applied to SAP environments
where stability and availability have traditionally been
prized above everything else. As a result, organizations
can deliver frequent, safe SAP releases and level the
playing field with their born-digital competitors. Download ebook >
Testfirst,
codelaterfor
greateragility
andspeed
A Basis Technologies white paper
basistechnologies.com
The DevOps methodology is based on
three core components…
Continuous
integration
Continuous
delivery
Continuous
deployment
Continuous integration
automatically executes
tests every time the
software is changed, in
order to verify its quality
Continuous delivery
automates the build
process that delivers
deployable software to
operations updates
Continuous deployment
automates the delivery of
new functionality to users
basistechnologies.com
basistechnologies.com
A Basis Technologies white paper
Automated unit testing is imperative for DevOps
Underpinning these components is automated testing, which is where significant gains
can be made both in terms of accelerating development and reducing costs. And these
gains not only apply to companies that are using DevOps, they are equally applicable to
organizations using Agile development or more traditional methods.
Automating testing ensures quality delivery at speed. Manual testing never
did keep up with the pace of delivery, and the problem gets worse when
delivery speed increases. Automated testing, built into the continuous
integration process and driven principally off APIs, gives developers the
fast feedback they need to improve quality. By the time the application is
deployed it is thoroughly tested, making release decisions simple.”
Kurt Bittner, Forrester
“ Source: Forget Two-Speed IT; DevOps
Enables Faster Delivery Across The Board
Vision: The Modern Application Delivery
Playbook by Kurt Bittner, Forrester,
November 6, 2015.
basistechnologies.com
A Basis Technologies white paper
The importance of testing
For many years it has been known that the true cost (and time) of fixing software defects increases
exponentially as a project progresses. For example, a defect discovered once software is put into production is
reckoned to cost one hundred times more to fix than one discovered in the development phase.
It is also true that integration testing and end-to-end testing carried out in the quality assurance (QA) phase of
a project is more time-consuming and expensive than testing during the development process.
Hence adequate unit testing must be carried out before anything is submitted to QA, to ensure that
software changes operate properly and without errors. The goal is to identify problems and bugs early in the
development lifecycle, but the process of unit testing can be very time consuming, not to mention tedious.
The answer? Automation. Automated unit testing not only saves time, it also ensures that
effects on other parts of the application are revealed and can be fully checked.
time
cost $
basistechnologies.com
A Basis Technologies white paper
Shifting testing as far left as possible not only reduces costs massively, it accelerates
development significantly. The message is clear: whether or not organizations are
following a DevOps methodology, automated unit testing allows them to deliver
quality code faster and more frequently. In fact, in a true DevOps process automated
unit tests are a prerequisite for continuous integration.
In their quest to maximise speed and agility, many organizations have even gone
one step further with the adoption of test-driven development, which encourages
simpler designs and better overall code.
Shift left
time
cost $
A Basis Technologies white paper
basistechnologies.com
There are some key principles that need to be considered when writing unit tests, in order to
deliver a successful outcome.
	 Independence – when multiple instances of the same test are run in parallel they should
deliver the same results. To make sure that one failing unit test doesn’t affect others, you
must make sure that each can be run independently. The power of unit tests is that they will
clearly indicate the source of any errors and even tell you how to fix them.
	Consistency – a test should deliver the same results when it is re-run (all other things being
equal). Results should not depend on the environment or external data.
	 A single unit of work – it’s important to test small parts of code that have distinct
functions. The narrower the test scope, the easier it will be to identify and resolve issues.
Unit testing
and test-driven
development go
hand-in-hand
A Basis Technologies white paper
basistechnologies.com
	Good code coverage – the test needs to ensure that all the code is executed,
including exceptions.
	 Run fast – if the test fails the developer needs to know quickly so that it can be fixed
or backed out of a release.
Test-driven development goes hand-in-hand with unit testing, and in doing so turns
the typical development process on its head. It’s a robust way of designing software
components, or units, interactively so that their behaviour is specified through unit tests.
Unit testing
and test-driven
development go
hand-in-hand
basistechnologies.com
A Basis Technologies white paper
Automated unit testing is the plankton
of change in DevOps - without it
everything else falls apart.”
Darren Thorpe, Chief Technology Officer, Basis Technologies
“
basistechnologies.com
basistechnologies.com
A Basis Technologies white paper
Before any code is written a unit test must be defined.
Crucially, in order to do this the a developer must
clearly understand any new features, specifications and
requirements.
Once the unit test has been created, existing code is run
against it. The test should fail because the new application
code hasn’t been written yet.
The aim at this stage is to simply write the minimum code
required to pass the unit test, and no more. When this has
been achieved, the new code is run against the new test and
all previous tests. The goal is to ensure that not only does
the code pass the new test, but that it also doesn’t adversely
impact any existing features.
If all tests are passed the project moves to the final stage –
peer review – before all tests are run again. Only when this has
been completed is the code passed to quality assurance or
pre-production.
Peer
review
Quality
assurance
Write
unit testbrief
Write
code
FAIL
PASSRun
unit test
basistechnologies.com
A Basis Technologies white paper
Based on SOLID programming
Many organizations struggle to implement automated unit testing and test-driven development
effectively. This is often because the traditional design and development processes they use
don’t deliver the required outcomes.
An object-oriented methodology will ensure that applications are easier to maintain and extend
over time but there are some key concepts that need to be considered when adopting this type
of approach.
In our experience at Basis Technologies, successful unit testing and test-driven development
programmes are based on the five core principles of SOLID. In particular, principles 1 and 5 –
Segregation of Responsibility and Dependency Injection – are crucially important
S O L I DSegregationof
Responsibility
Open
Closed
Principle
Liskov
Substitution
Principle
Interface
Segregation
Dependency
Injection
basistechnologies.com
A Basis Technologies white paper
Segregation of
Responsibility
The new code being
developed should only
do one thing
	
Open Closed
Principle
Classes should be
open for extension
and closed for
modification. Instead
of modifying a class
that does not quite
fit the needs, a new
class that inherits the
features of the original
class and adds new
features should be
declared
Liskov Substitution
Principle
Derived classes
must be completely
substitutable for their
base classes. Although
base class functionality
can be overridden it
should only be done
with great care, as it
can create confusion
Interface
Segregation
Classes should not
be forced to rely on
interfaces that they
don’t need. The fact
is that it’s better to
have many specific
interfaces than it is
to have one large
interface.
Dependency
Injection
A strategy for
decoupling software
and simplifying unit
tests. Creating mock
dependencies that
mimic the behavior
of real objects in
controlled ways
enables all the external
dependencies of a
software unit under
test to be controlled.
core principles
of SOLID
51 2 3 4 5
basistechnologies.com
A Basis Technologies white paper
basistechnologies.com
steps to a successful
culture shift
The concepts discussed here can be difficult for programmers steeped in
traditional software creation techniques to assimilate, as they apparently
turn the whole process on its head. Yet getting developer buy-in is essential
to making automated unit testing and test-driven development work, and
benefitting from the resultant gains. Consequently, it is essential to put a
robust change management programme in place.
Following these steps will ensure a smooth transition…
5
! !
!
!
!
! !
basistechnologies.com
A Basis Technologies white paper
basistechnologies.com
Once developers are trained, particularly in the principles of
SOLID, and start to see how effective the process is, they
will become advocates and win over their less enthusiastic
colleagues. In our experience, once programmers start using
these concepts they become more committed and have a
greater sense of ownership about the code they create. Their
work becomes more enjoyable and provides greater value.
Enlist volunteers
1
basistechnologies.com
A Basis Technologies white paper
Investigate tools
like ABAP Unit
This is available as a standard SAP tool, allowing
unit tests to be built and executed for ABAP
code. When using the techniques described in
this document (particularly especially object-
oriented principles like SOLID) the unit testing
of classes will become much simpler. There are
several resources available to show how this
is done - the following is useful, for example:
http://zevolving.com/category/abapobjects/
abap-unit-test/
2
basistechnologies.com
basistechnologies.com
A Basis Technologies white paper
Create a sense
of urgency
! !
!
!
!
! !
Start to request and implement
functional changes on a more
frequent basis, rather than storing
everything up for major releases.
Make a decision that automated
unit testing will be implemented
from the very  start of the next new
development or project, and ensure
that nothing leaves development
unless unit testing has been
successfully carried out.
3
basistechnologies.com
basistechnologies.com
A Basis Technologies white paper
Establish an environment in which people
can make mistakes without fear of criticism.
This is a major change and it will take time for
developers to adapt to the new techniques
and tools. Introducing peer reviews of code
and unit tests will help to share knowledge and
get people up to speed.
Establish the right
environment
4
basistechnologies.com
basistechnologies.com
A Basis Technologies white paper
Point out the career-enhancing benefits and the
positive effect on employees’ CVs. As the pace
of digitalization hots up, and SAP reinvents its
software portfolio for the digital economy, the
requirement for fast, accurate releases will only
increase. As a result, developers that have the
necessary skills to support agile development will
be in great demand.
Point out the career-
enhancing benefits
5
basistechnologies.com
A Basis Technologies white paper
basistechnologies.com
Delivering faster doesn’t require
organizations to cut quality corners or drive
people to unsustainable overwork. It does
require ADD leaders to fundamentally
change the way their teams organize, staff,
collaborate, and automate. Delivering
software applications faster, yet with higher
quality, requires more than simply doing
the same things faster; it requires nothing
short of complete reinvention.”
Kurt Bittner, Forrester
“
Source: Forget Two-Speed IT; DevOps Enables Faster Delivery Across The
Board Vision: The Modern Application Delivery Playbook by Kurt Bittner,
Forrester, November 6, 2015.
A Basis Technologies white paper
The real benefit of faster application delivery
is being able to try new ideas faster, to gather
customer and user feedback faster, and to be
able to act on that feedback faster. Doing so
improves business performance by attracting
new customers and retaining the ones you
already have.”
Kurt Bittner, Forresterr
“
Source: Forget Two-Speed IT; DevOps Enables Faster Delivery Across The
Board Vision: The Modern Application Delivery Playbook by Kurt Bittner,
Forrester, November 6, 2015.
basistechnologies.com
basistechnologies.com
A Basis Technologies white paper
Automated unit testing and test-driven development offer organizations the opportunity to shift-left quality
control and address defect fixes at the development stage. Whether combined with a DevOps approach or even
Agile and more traditional project methodologies, it enables organizations to dramatically reduce the cost of
software defects, accelerate the development of code, and deliver new functionality faster.
But that’s not all. Though this kind of cultural shift may require significant amounts of persuasion and effort
up-front, the positive impact is not only seen during the development of new features. IT organizations
typically spend 70-80% of their budget on ‘keeping the lights on’, and improving existing products and services.
Integration of automated unit testing into the development process ensures that future maintenance will become
cheaper, less time consuming and a lot less risky. That means scarce IT resources can be allocated to work that
can deliver more value, more quickly.
As a result, companies can adapt their systems of engagement faster to take advantage of changing consumer
expectations, new technology-driven opportunities, and dynamic market, economic, and business conditions.
Unit testing…
increases product quality
increases agility
improves digital transformation
A Basis Technologies white paper
©BasisTechnologiesInternational
Ltd.,2015.Allrightsreserved.This
documentisnon-contractual.
eoe.5513_Unit_Testing_0116
Canada
+1 703 476 4565
Germany
+49 30 300 11 4606
USA
+1 703 476 4565
UK
+44 20 7958 9025
In the digital economy, agility is fundamental. We focus on continuous
delivery – helping our customers align IT closer to the business.
At Basis Technologies we create automation tools that allow companies
to deliver enterprise application changes at the speed of business. By
harnessing the agility of our DevOps suite, thousands of IT professionals
worldwide are able to deliver high-quality SAP releases at pace capitalizing
on their current infrastructure and remaining relevant to future business
strategy. The results produce faster time-to-market, longer production
uptime, and lower operational costs.
Email	info@basistechnologies.com	
Follow	
Discover how we can
help you can move to a
test-driven development
environment 
basistechnologies.com

Mais conteúdo relacionado

Mais de Basis Technologies

Transport expresso-combined-feature-sheets
Transport expresso-combined-feature-sheetsTransport expresso-combined-feature-sheets
Transport expresso-combined-feature-sheets
Basis Technologies
 
6 Kick-Ass Tips to Improve SAP Performance
6 Kick-Ass Tips to Improve SAP Performance6 Kick-Ass Tips to Improve SAP Performance
6 Kick-Ass Tips to Improve SAP Performance
Basis Technologies
 

Mais de Basis Technologies (12)

Basis Technologies DevOps and Testing Platform for SAP
Basis Technologies DevOps and Testing Platform for SAP Basis Technologies DevOps and Testing Platform for SAP
Basis Technologies DevOps and Testing Platform for SAP
 
DevOps Deep Dive Webinar: Building a business case for agile and devops
DevOps Deep Dive Webinar: Building a business case for agile and devopsDevOps Deep Dive Webinar: Building a business case for agile and devops
DevOps Deep Dive Webinar: Building a business case for agile and devops
 
8 steps to daily SAP releases
8 steps to daily SAP releases 8 steps to daily SAP releases
8 steps to daily SAP releases
 
BDEx - The must have tool for Utilities running SAP CR&B
BDEx - The must have tool for Utilities running SAP CR&BBDEx - The must have tool for Utilities running SAP CR&B
BDEx - The must have tool for Utilities running SAP CR&B
 
Transport expresso-combined-feature-sheets
Transport expresso-combined-feature-sheetsTransport expresso-combined-feature-sheets
Transport expresso-combined-feature-sheets
 
RS Components reduce downtime and enable aggressive SAP rollout strategy to s...
RS Components reduce downtime and enable aggressive SAP rollout strategy to s...RS Components reduce downtime and enable aggressive SAP rollout strategy to s...
RS Components reduce downtime and enable aggressive SAP rollout strategy to s...
 
7 fatal assumptions about SAP agility
7 fatal assumptions about SAP agility7 fatal assumptions about SAP agility
7 fatal assumptions about SAP agility
 
The 7 circles of SAP project delivery hell - Why system changes are slow, clu...
The 7 circles of SAP project delivery hell - Why system changes are slow, clu...The 7 circles of SAP project delivery hell - Why system changes are slow, clu...
The 7 circles of SAP project delivery hell - Why system changes are slow, clu...
 
How CBH Group delivers SAP change that keeps pace with business demands
How CBH Group delivers SAP change that keeps pace with business demandsHow CBH Group delivers SAP change that keeps pace with business demands
How CBH Group delivers SAP change that keeps pace with business demands
 
Using the 5 WHYs to determine why your SAP Major Incident really happened
Using the 5 WHYs to determine why your SAP Major Incident really happenedUsing the 5 WHYs to determine why your SAP Major Incident really happened
Using the 5 WHYs to determine why your SAP Major Incident really happened
 
Play Tetris in your SAP system
Play Tetris in your SAP systemPlay Tetris in your SAP system
Play Tetris in your SAP system
 
6 Kick-Ass Tips to Improve SAP Performance
6 Kick-Ass Tips to Improve SAP Performance6 Kick-Ass Tips to Improve SAP Performance
6 Kick-Ass Tips to Improve SAP Performance
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

Unit Test Automation: The prerequisite for Continuous Delivery in SAP environments

  • 1. basistechnologies.com A Basis Technologies white paperA Basis Technologies white paper basistechnologies.com Unit Test Automation A step towards Agile delivery and DevOps in SAP basistechnologies.com Digital changes everything A seismic shift in the way companies operate and engage with customers is occurring. It’s being driven by a perfect storm of technological development. And it’s changing everything. In our previous e-book – 8 steps to daily SAP releases – we saw that born-digital companies are setting the pace when it comes to updating their customer engagement systems. And traditional companies must transform themselves if they are to compete successfully. The same e-book also demonstrated how DevOps – a software development and deployment methodology that emphasizes collaboration, communication, mixed discipline teams and, very importantly, automation – can be successfully applied to SAP environments where stability and availability have traditionally been prized above everything else. As a result, organizations can deliver frequent, safe SAP releases and level the playing field with their born-digital competitors. Download ebook > Testfirst, codelaterfor greateragility andspeed
  • 2. A Basis Technologies white paper basistechnologies.com The DevOps methodology is based on three core components… Continuous integration Continuous delivery Continuous deployment Continuous integration automatically executes tests every time the software is changed, in order to verify its quality Continuous delivery automates the build process that delivers deployable software to operations updates Continuous deployment automates the delivery of new functionality to users basistechnologies.com
  • 3. basistechnologies.com A Basis Technologies white paper Automated unit testing is imperative for DevOps Underpinning these components is automated testing, which is where significant gains can be made both in terms of accelerating development and reducing costs. And these gains not only apply to companies that are using DevOps, they are equally applicable to organizations using Agile development or more traditional methods. Automating testing ensures quality delivery at speed. Manual testing never did keep up with the pace of delivery, and the problem gets worse when delivery speed increases. Automated testing, built into the continuous integration process and driven principally off APIs, gives developers the fast feedback they need to improve quality. By the time the application is deployed it is thoroughly tested, making release decisions simple.” Kurt Bittner, Forrester “ Source: Forget Two-Speed IT; DevOps Enables Faster Delivery Across The Board Vision: The Modern Application Delivery Playbook by Kurt Bittner, Forrester, November 6, 2015.
  • 4. basistechnologies.com A Basis Technologies white paper The importance of testing For many years it has been known that the true cost (and time) of fixing software defects increases exponentially as a project progresses. For example, a defect discovered once software is put into production is reckoned to cost one hundred times more to fix than one discovered in the development phase. It is also true that integration testing and end-to-end testing carried out in the quality assurance (QA) phase of a project is more time-consuming and expensive than testing during the development process. Hence adequate unit testing must be carried out before anything is submitted to QA, to ensure that software changes operate properly and without errors. The goal is to identify problems and bugs early in the development lifecycle, but the process of unit testing can be very time consuming, not to mention tedious. The answer? Automation. Automated unit testing not only saves time, it also ensures that effects on other parts of the application are revealed and can be fully checked. time cost $
  • 5. basistechnologies.com A Basis Technologies white paper Shifting testing as far left as possible not only reduces costs massively, it accelerates development significantly. The message is clear: whether or not organizations are following a DevOps methodology, automated unit testing allows them to deliver quality code faster and more frequently. In fact, in a true DevOps process automated unit tests are a prerequisite for continuous integration. In their quest to maximise speed and agility, many organizations have even gone one step further with the adoption of test-driven development, which encourages simpler designs and better overall code. Shift left time cost $
  • 6. A Basis Technologies white paper basistechnologies.com There are some key principles that need to be considered when writing unit tests, in order to deliver a successful outcome. Independence – when multiple instances of the same test are run in parallel they should deliver the same results. To make sure that one failing unit test doesn’t affect others, you must make sure that each can be run independently. The power of unit tests is that they will clearly indicate the source of any errors and even tell you how to fix them. Consistency – a test should deliver the same results when it is re-run (all other things being equal). Results should not depend on the environment or external data. A single unit of work – it’s important to test small parts of code that have distinct functions. The narrower the test scope, the easier it will be to identify and resolve issues. Unit testing and test-driven development go hand-in-hand
  • 7. A Basis Technologies white paper basistechnologies.com Good code coverage – the test needs to ensure that all the code is executed, including exceptions. Run fast – if the test fails the developer needs to know quickly so that it can be fixed or backed out of a release. Test-driven development goes hand-in-hand with unit testing, and in doing so turns the typical development process on its head. It’s a robust way of designing software components, or units, interactively so that their behaviour is specified through unit tests. Unit testing and test-driven development go hand-in-hand
  • 8. basistechnologies.com A Basis Technologies white paper Automated unit testing is the plankton of change in DevOps - without it everything else falls apart.” Darren Thorpe, Chief Technology Officer, Basis Technologies “ basistechnologies.com
  • 9. basistechnologies.com A Basis Technologies white paper Before any code is written a unit test must be defined. Crucially, in order to do this the a developer must clearly understand any new features, specifications and requirements. Once the unit test has been created, existing code is run against it. The test should fail because the new application code hasn’t been written yet. The aim at this stage is to simply write the minimum code required to pass the unit test, and no more. When this has been achieved, the new code is run against the new test and all previous tests. The goal is to ensure that not only does the code pass the new test, but that it also doesn’t adversely impact any existing features. If all tests are passed the project moves to the final stage – peer review – before all tests are run again. Only when this has been completed is the code passed to quality assurance or pre-production. Peer review Quality assurance Write unit testbrief Write code FAIL PASSRun unit test
  • 10. basistechnologies.com A Basis Technologies white paper Based on SOLID programming Many organizations struggle to implement automated unit testing and test-driven development effectively. This is often because the traditional design and development processes they use don’t deliver the required outcomes. An object-oriented methodology will ensure that applications are easier to maintain and extend over time but there are some key concepts that need to be considered when adopting this type of approach. In our experience at Basis Technologies, successful unit testing and test-driven development programmes are based on the five core principles of SOLID. In particular, principles 1 and 5 – Segregation of Responsibility and Dependency Injection – are crucially important S O L I DSegregationof Responsibility Open Closed Principle Liskov Substitution Principle Interface Segregation Dependency Injection
  • 11. basistechnologies.com A Basis Technologies white paper Segregation of Responsibility The new code being developed should only do one thing Open Closed Principle Classes should be open for extension and closed for modification. Instead of modifying a class that does not quite fit the needs, a new class that inherits the features of the original class and adds new features should be declared Liskov Substitution Principle Derived classes must be completely substitutable for their base classes. Although base class functionality can be overridden it should only be done with great care, as it can create confusion Interface Segregation Classes should not be forced to rely on interfaces that they don’t need. The fact is that it’s better to have many specific interfaces than it is to have one large interface. Dependency Injection A strategy for decoupling software and simplifying unit tests. Creating mock dependencies that mimic the behavior of real objects in controlled ways enables all the external dependencies of a software unit under test to be controlled. core principles of SOLID 51 2 3 4 5
  • 12. basistechnologies.com A Basis Technologies white paper basistechnologies.com steps to a successful culture shift The concepts discussed here can be difficult for programmers steeped in traditional software creation techniques to assimilate, as they apparently turn the whole process on its head. Yet getting developer buy-in is essential to making automated unit testing and test-driven development work, and benefitting from the resultant gains. Consequently, it is essential to put a robust change management programme in place. Following these steps will ensure a smooth transition… 5 ! ! ! ! ! ! !
  • 13. basistechnologies.com A Basis Technologies white paper basistechnologies.com Once developers are trained, particularly in the principles of SOLID, and start to see how effective the process is, they will become advocates and win over their less enthusiastic colleagues. In our experience, once programmers start using these concepts they become more committed and have a greater sense of ownership about the code they create. Their work becomes more enjoyable and provides greater value. Enlist volunteers 1
  • 14. basistechnologies.com A Basis Technologies white paper Investigate tools like ABAP Unit This is available as a standard SAP tool, allowing unit tests to be built and executed for ABAP code. When using the techniques described in this document (particularly especially object- oriented principles like SOLID) the unit testing of classes will become much simpler. There are several resources available to show how this is done - the following is useful, for example: http://zevolving.com/category/abapobjects/ abap-unit-test/ 2 basistechnologies.com
  • 15. basistechnologies.com A Basis Technologies white paper Create a sense of urgency ! ! ! ! ! ! ! Start to request and implement functional changes on a more frequent basis, rather than storing everything up for major releases. Make a decision that automated unit testing will be implemented from the very  start of the next new development or project, and ensure that nothing leaves development unless unit testing has been successfully carried out. 3 basistechnologies.com
  • 16. basistechnologies.com A Basis Technologies white paper Establish an environment in which people can make mistakes without fear of criticism. This is a major change and it will take time for developers to adapt to the new techniques and tools. Introducing peer reviews of code and unit tests will help to share knowledge and get people up to speed. Establish the right environment 4 basistechnologies.com
  • 17. basistechnologies.com A Basis Technologies white paper Point out the career-enhancing benefits and the positive effect on employees’ CVs. As the pace of digitalization hots up, and SAP reinvents its software portfolio for the digital economy, the requirement for fast, accurate releases will only increase. As a result, developers that have the necessary skills to support agile development will be in great demand. Point out the career- enhancing benefits 5 basistechnologies.com
  • 18. A Basis Technologies white paper basistechnologies.com Delivering faster doesn’t require organizations to cut quality corners or drive people to unsustainable overwork. It does require ADD leaders to fundamentally change the way their teams organize, staff, collaborate, and automate. Delivering software applications faster, yet with higher quality, requires more than simply doing the same things faster; it requires nothing short of complete reinvention.” Kurt Bittner, Forrester “ Source: Forget Two-Speed IT; DevOps Enables Faster Delivery Across The Board Vision: The Modern Application Delivery Playbook by Kurt Bittner, Forrester, November 6, 2015.
  • 19. A Basis Technologies white paper The real benefit of faster application delivery is being able to try new ideas faster, to gather customer and user feedback faster, and to be able to act on that feedback faster. Doing so improves business performance by attracting new customers and retaining the ones you already have.” Kurt Bittner, Forresterr “ Source: Forget Two-Speed IT; DevOps Enables Faster Delivery Across The Board Vision: The Modern Application Delivery Playbook by Kurt Bittner, Forrester, November 6, 2015. basistechnologies.com
  • 20. basistechnologies.com A Basis Technologies white paper Automated unit testing and test-driven development offer organizations the opportunity to shift-left quality control and address defect fixes at the development stage. Whether combined with a DevOps approach or even Agile and more traditional project methodologies, it enables organizations to dramatically reduce the cost of software defects, accelerate the development of code, and deliver new functionality faster. But that’s not all. Though this kind of cultural shift may require significant amounts of persuasion and effort up-front, the positive impact is not only seen during the development of new features. IT organizations typically spend 70-80% of their budget on ‘keeping the lights on’, and improving existing products and services. Integration of automated unit testing into the development process ensures that future maintenance will become cheaper, less time consuming and a lot less risky. That means scarce IT resources can be allocated to work that can deliver more value, more quickly. As a result, companies can adapt their systems of engagement faster to take advantage of changing consumer expectations, new technology-driven opportunities, and dynamic market, economic, and business conditions. Unit testing… increases product quality increases agility improves digital transformation
  • 21. A Basis Technologies white paper ©BasisTechnologiesInternational Ltd.,2015.Allrightsreserved.This documentisnon-contractual. eoe.5513_Unit_Testing_0116 Canada +1 703 476 4565 Germany +49 30 300 11 4606 USA +1 703 476 4565 UK +44 20 7958 9025 In the digital economy, agility is fundamental. We focus on continuous delivery – helping our customers align IT closer to the business. At Basis Technologies we create automation tools that allow companies to deliver enterprise application changes at the speed of business. By harnessing the agility of our DevOps suite, thousands of IT professionals worldwide are able to deliver high-quality SAP releases at pace capitalizing on their current infrastructure and remaining relevant to future business strategy. The results produce faster time-to-market, longer production uptime, and lower operational costs. Email info@basistechnologies.com Follow Discover how we can help you can move to a test-driven development environment basistechnologies.com