SlideShare a Scribd company logo
Shift-Left Testing
QA in a DevOps World
David Laulusa
@dlaulusa
Feb 25, 2020
About Me
• Brigham Young University, BS/EE
• Princeton University, MS/EE
• 20+ yrs in industry
• Development/QA
• Startups, Large Enterprises, Permanent/Contract
• Telecommute
• DevOpsDays Columbus
Laulusa
Laulusa
Laulusa
Laulusa
Laulusa
Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Agenda
Inject quality earlier in the process
You cannot inspect quality
into a product.
- Harold F. Dodge
Inspection does not improve the quality,
nor guarantee quality. Inspection is too
late. The quality, good or bad, is already
in the product.
- William Deming
Quality is not an act.
It is a habit.
- Aristotle
Agenda
• Testing Principles
• Testing Partners
• Test
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Continuous Delivery is the NEW Agile
Satisfy the customer through early and
continuous delivery of valuable software
- Agile Manifesto
SMALL BATCHES
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
F1
Design
Dev
Test
Deploy
F2
Design
Dev
Test
Deploy
B1
Design
Dev
Test
Deploy
B2
Design
Dev
Test
Deploy
F3
Design
Dev
Test
Deploy
B3
Design
Dev
Test
Deploy
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing
Static Unit Integration End-to-End Acceptance
Bugs are cheaper when caught young.
- Larry Smith
Shift-Left Testing: QA in a DevOps World by David Laulusa
TESTING PRINCIPLES
Testing a System
System
Expected Outputs
Inputs
Input Domain
• The input domain contains all possible inputs.
• Choose a finite set of values.
• Include valid, invalid and special values
• Include values that represent “normal use” (domain-specific knowledge)
• Test selection is about sampling the input space in a cost-effective manner.
EQUIVALENCE CLASSES
Equivalence Classes
• All members of an equivalence class contribute to the fault detection
in the same way.
• The combination of all equivalence classes must cover the entire
domain.
• Equivalence classes must not overlap.
• Select one value from each Equivalence Class.
• Choosing more than one value does not increase fault detection.
Range
• One class with values inside the range, and two with values outside
the range.
• If the range were 10 <= x <=20.
1.Equivalence Class 1: all numbers between 10 and 20, inclusive
2.Equivalence Class 2: all numbers less than 10
3.Equivalence Class 3: all numbers greater than 20
4.You could also do letters and special characters.
String
• At least one containing all legal strings and one containing all illegal
strings.
• For example, let fname: string be a variable to denote a first name.
1. Valid name {Sue}
2. Special characters {ε}
3. Number {7}
4. Too long {Too many characters so it would not be able to fit into
the database}
Enumeration
• Each value in a separate class.
• And then any other value.
• For example, consider auto_color ∈ {red, green , blue}.
• The following classes are generated, {{red}, {green}, {blue}, {blah}}
Array
• One class containing all legal arrays, one containing only the empty
array, and one containing arrays larger than the expected size.
• For example, consider int[] aName = new int [3].
• The following classes are generated:
1. {[]}
2. {[-10, 20]}
3. {[-9, 0, 12, 15]}
BOUNDARY VALUE
ANALYSIS
Boundary-Value Analysis
Programmers often make mistakes in processing values at and near
the boundaries of equivalence classes.
• min-1, min, min+1
• max-1, max, max+1
• 0, null, empty string
COMBINATORIAL TESTING
Combinatorial Testing
• Many defects only occur when a combination of inputs or events
occur that interact with each other.
• However, if you were to test every combination of inputs it may take
years especially with today’s complex systems.
• How do you choose which combination of inputs?
• Combinatorial testing is a technique for reducing the number of test
cases without drastically compromising functional coverage, in order
to get more ‘bang for the buck’.
Testing a System
X (1,2) Y (Q,R) Z (5,6)
System
Combinatorial Testing Where T = 2,
Pairwise Testing
Test Case X Y Z
TC1 1 Q 5
TC2 1 R 5
TC3 1 Q 6
TC4 1 R 6
TC5 2 Q 5
TC6 2 R 5
TC7 2 Q 6
TC8 2 R 6
Test Case X Y Z
TC1 1 Q 5
TC2 1 R 5
TC3 1 Q 6
TC4 1 R 6
TC5 2 Q 5
TC6 2 R 5
TC7 2 Q 6
TC8 2 R 6
Combinatorial Testing Where T = 2,
Pairwise Testing
Test Case X Y Z
TC1 1 Q 5
TC2 1 R 5
TC3 1 Q 6
TC4 1 R 6
TC5 2 Q 5
TC6 2 R 5
TC7 2 Q 6
TC8 2 R 6
Combinatorial Testing Where T = 2,
Pairwise Testing
Combinatorial Testing Where T = 2,
Pairwise Testing
Test Case X Y Z
TC1 1 Q 5
TC2 1 R 5
TC3 1 Q 6
TC4 1 R 6
TC5 2 Q 5
TC6 2 R 5
TC7 2 Q 6
TC8 2 R 6
Combinatorial Testing Where T = 2,
Pairwise Testing
Test Case X Y Z
TC1 1 Q 5
TC4 1 R 6
TC6 2 R 5
TC7 2 Q 6
TC8 2 R 6
Combinatorial Testing Where T = 2,
Pairwise Testing
Test Case X Y Z
TC1 1 Q 5
TC4 1 R 6
TC6 2 R 5
TC7 2 Q 6
Combinatorial Testing Where T = 2,
Pairwise Testing
Test Case X Y Z
TC1 1 Q 5
TC4 1 R 6
TC6 2 R 5
TC7 2 Q 6
• Going from 8 -> 4 isn’t that big a deal
• Reducing # tests 50% is not that big a deal either
• Reducing by hand is tedious
Android Options
Parameter Values
HardKeyboardHidden No, Undefined, Yes
KeyboardHidden No, Undefined, Yes
Keyboard 12Key, NoKeys, Qwerty, Undefined
NavigationHidden No, Undefined, Yes
Navigation Dpad, NoNav, Trackball, Undefined, Wheel
Orientation Landscape, Portrait, Square, Undefined
ScreenLayout_Long Mask, No, Undefined, Yes
ScreenLayout_Size Large, Mask, Normal, Small, Undefined
TouchScreen Finger, NoTouch, Stylus, Undefined
3*3*4*3*5*4*4*5*4 = 172,800 combinations
Combinatorial Testing to the Rescue
T # Tests % of Total (172k) % Defects Found
2 29 0.02% 76%
3 137 0.08% 95%
4 625 0.4% 97%
5 2532 1.5% 99%
6 9168 5.3% 100%
• The savings as a percentage of exhaustive testing depends on the
number of parameters and the # of values for the parameters.
• With larger systems the savings can be enormous
“There’s an App for that”
• AllPairs (perl)
• PICT (Microsoft)
• ACTS (NIST)
When Not to Use Combinatorial Testing
• When you really do have to test all combinations
• This assumes a uniform distribution across all
combinations.
• Some combinations are more important than others.
• Some combinations are impossible.
T-Way - Effective in Finding Those Pesky Bugs
0
10
20
30
40
50
60
70
80
90
100
1 2 3 4 5 6
# Interacting Parameters Leading to Failure
Browser Bugs (194) Server Bugs (171)
Fly With Us – We found 90% of the defects!
DEPENDENCY INJECTION
Dependency Injection
In software engineering, dependency injection is a software design pattern
that implements inversion of control for resolving dependencies. A
dependency is an object that can be used (a service). An injection is the
passing of a dependency to a dependent object (a client) that would use it.
sub method {
my $self = shift;
my $obj = MyProject::Class->new();
my $x = $obj->get_something();
. . .
return($x);
}
sub method {
my $self = shift;
my $obj = shift;
my $x = $obj->get_something();
. . .
return($x);
}
PARTNER WITH
DEVELOPMENT
Grooming the Backlog
• Make sure that there are sane completion requirements
• Is it testable?
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Why Do We Unit Test?
static OSStatus
SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer
signedParams, uint8_t *signature, UInt16 signatureLen) {
OSStatus err;
...
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
goto fail;
goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
goto fail;
...
fail:
SSLFreeBuffer(&signedHashes);
SSLFreeBuffer(&hashCtx);
return err;
}
Why Do We Unit Test?
• It gives you confidence that your code works as you expect it to work.
• Easily refactor your code to make it cleaner and more efficient.
• Saves time because unit tests help prevent regressions from being introduced and
released.
• Once a bug is found, you can write a unit test for it, you can fix the bug, and the bug can
never make it to production again because the unit tests will catch it in the future. (shift left
testing)
• Implicit documentation
How Do We Unit Test?
• Unit tests test units in isolation, in a dedicated, controlled environment.
• Each unit test creates in own environment by instantiating only the classes
needed to execute one test, putting them in a known state, then it invokes the
method to be tested and verify the outcome.
• This verification is done by assertions on the behavior of the method (as opposed
to its implementation).
• Performing the verification on the behavior and not on the implementation is
important as this allows modifying the implementation without breaking the unit
tests, and therefore using the unit tests as a safety net for the modification.
What Do We Unit Test?
• Generally a method.
• Need to write tests for the public methods.
• Could write tests for private methods, but it means you might have
to re-write these tests when you re-factor.
• No need to write tests for trivial setter/getters.
Anatomy of a Unit Test
• Set up all conditions for testing.
• Call the method (or Trigger) being tested.
• Verify that the results are correct.
• Clean up modified records.
Unit Tests
• Make each test orthogonal (i.e., independent) to all the others
• Don’t make unnecessary assertions
• Test only one code unit at a time
• Mock out all external services and state
• Avoid unnecessary preconditions
• Unit tests should ideally take less than 5 min to run. If it approaches 10 min, then
we can break them up and run sets in parallel.
• Unit tests will run each time code is checked in.
• Builds cannot progress unless all unit tests pass.
A Test is not a unit test if:
• It talks to the database
• It communicates across the network
• It touches the file system
• It can't run at the same time as any of your other unit tests
• You have to do special things to your environment (such as editing
config files) to run it.
Shift-Left Testing: QA in a DevOps World by David Laulusa
TEST-DRIVEN
DEVELOPMENT
Test-Driven Development
• write a failing test
• write just enough code to make it pass
• refactor the code to clean it up
TDD
• TDD is a design process, not a testing process.
• Unit tests help to shape your design.
• TDD is a robust way of designing software components (“units”) interactively so
that their behavior is specified through unit tests.
• TDD helps you to deliver software components that individually behave according
to your design.
• A suite of good unit tests is immensely valuable: it documents your design, and
makes it easier to refactor and expand your code while retaining a clear overview
of each component’s behavior.
Shift-Left Testing: QA in a DevOps World by David Laulusa
REGRESSION TESTING
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
CODE COVERAGE
Code Coverage
• Code coverage is a measure used to describe the degree to which
the source code of a program is executed when a particular test
suite runs.
• A program with high code coverage, measured as a percentage,
has had more of its source code executed during testing which
suggests it has a lower chance of containing undetected software
bugs compared to a program with low code coverage.
Code Coverage
• Function coverage
• Statement coverage
• Branch coverage
• Conditional coverage
Code Coverage
sub foo {
my($x, $y) = @_;
if ($x eq ‘string’ && $y < 10) {
return 1;
}
else {
return 0;
}
}
Code Coverage
100%?
Shift-Left Testing: QA in a DevOps World by David Laulusa
PROFILE YOUR CODE
Profiling Your Code
Profiling is a form of dynamic program analysis that can measure
things like:
• memory usage
• time complexity of a program
• usage of particular instructions
• frequency and duration of function calls
Profiling Your Code
• optimization
• algorithm
• loops
• expensive function calls, including system calls
• lazy building
PARTNER WITH
PRODUCT OWNER
USER ACCEPTANCE
TESTING
Shift-Left Testing: QA in a DevOps World by David Laulusa
Acceptance Testing - Example
Test Specification:
• Free shipping a month before Christmas
Test Code
@Test
public void
orderLessThenAMonthBeforeChristmasShouldGiveZeroShipping() {
Calendar purchaseDate = GregorianCalendar.getInstance();
purchaseDate.set(Calendar.YEAR, 2014);
purchaseDate.set(Calendar.MONTH, Calendar.NOVEMBER);
purchaseDate.set(Calendar.DAY_OF_MONTH, 24);
int christmasEve = 24;
int expectedShipping = 0;
String expectedCurrency = “USD";
Date purchase = purchaseDate.getTime();
Shipping shipping = new Shipping(purchase, christmasEve);
int actualCost = shipping.getCost();
assertThat(actualCost, is(expectedShipping));
}
Cucumber - Layers
Execute Specification (Gherkin)
Step Definitions - Glue (47
languages)
System Under Test
Cucumber - Specification
Scenario: Free shipping a month before Christmas
Given a customer that Christmas is celebrated 24 of December
When a customer buys a book on 2014-12-10
Then the shipping cost should be $0
Cucumber - Step Definitions
@When("^a customer buys a book on (.*)$")
public void
buyBook(@Format("yyyy-MM-dd") Date purchaseDate)
throws Throwable {
this.purchaseDate = purchaseDate;
}
Shift-Left Testing: QA in a DevOps World by David Laulusa
MUTATION TESTING
Mutation Testing
• White Box Testing
• Mutate (change) certain statements in the source code and check if
the test cases are able to find the errors.
• This is called killing the mutant. Test suites are measured by the
percentage of mutants that they kill.
• New tests can be designed to kill additional mutants.
Shift-Left Testing: QA in a DevOps World by David Laulusa
Other Types of Testing
• Security Testing
• Performance Testing
• Compliance Testing
• Resiliency Testing
EXPLORATORY TESTING
Shift-Left Testing: QA in a DevOps World by David Laulusa
Shift-Left Testing: QA in a DevOps World by David Laulusa
PARTNER WITH
EXTERNAL
STAKEHOLDERS
INTER-SYSTEM TESTING
Shift-Left Testing: QA in a DevOps World by David Laulusa
PARTNER WITH
OPERATIONS
Shift-Left Testing: QA in a DevOps World by David Laulusa
Testing in Production
• Logging
• Server Monitoring
• Application Performance Monitoring
• Health Check
Shift-Left Testing: QA in a DevOps World by David Laulusa
TEST
Burger World Burger:
How Many?:
Here: To Go:
Lettuce:
Tomato:
Pickle:
Onions:
Mayo:
Ketchup:
Mustard:
Instructions:
Order Cancel
QUESTIONS?
THANKS
David Laulusa
@dlaulusa

More Related Content

What's hot (20)

PPTX
The Art of Gherkin Scripting - Matt Eakin
QA or the Highway
 
PPTX
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Neotys_Partner
 
PDF
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
Eclipse Day India
 
PDF
Test Driven Development
ZendCon
 
PDF
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat
 
PDF
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
Hendrik Neumann
 
PPTX
Predictive Analytics based Regression Test Optimization
STePINForum
 
PPT
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
TEST Huddle
 
PPTX
Software Testing, Everyone's responsibility
Kurt Bliefernich
 
PPTX
Example of TAF with batch execution of test cases
COMAQA.BY
 
PPTX
Best practices for test automation
David Tzemach
 
PPTX
Continuous Performance Testing with Taurus and Jmeter
Agile Testing Alliance
 
PPTX
All you need to know about regression testing | David Tzemach
David Tzemach
 
PPTX
ISTQB Advanced Test Manager Training
HiraQureshi22
 
PPTX
[DevDay2019] Power of Test Automation and DevOps combination - One click savi...
DevDay Da Nang
 
PPTX
Embedded Testing 2015
Vassilis Rizopoulos
 
PDF
Resilience testing! Why should you
Geoffrey van der Tas
 
PDF
SFScon 21 - Matteo Camilli - Performance assessment of microservices with str...
South Tyrol Free Software Conference
 
PDF
Test Pyramid vs Roi
COMAQA.BY
 
PDF
Patterns of a "Good" Test Automation Framework, Locators & Data
Agile Testing Alliance
 
The Art of Gherkin Scripting - Matt Eakin
QA or the Highway
 
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Neotys_Partner
 
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
Eclipse Day India
 
Test Driven Development
ZendCon
 
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat
 
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
Hendrik Neumann
 
Predictive Analytics based Regression Test Optimization
STePINForum
 
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
TEST Huddle
 
Software Testing, Everyone's responsibility
Kurt Bliefernich
 
Example of TAF with batch execution of test cases
COMAQA.BY
 
Best practices for test automation
David Tzemach
 
Continuous Performance Testing with Taurus and Jmeter
Agile Testing Alliance
 
All you need to know about regression testing | David Tzemach
David Tzemach
 
ISTQB Advanced Test Manager Training
HiraQureshi22
 
[DevDay2019] Power of Test Automation and DevOps combination - One click savi...
DevDay Da Nang
 
Embedded Testing 2015
Vassilis Rizopoulos
 
Resilience testing! Why should you
Geoffrey van der Tas
 
SFScon 21 - Matteo Camilli - Performance assessment of microservices with str...
South Tyrol Free Software Conference
 
Test Pyramid vs Roi
COMAQA.BY
 
Patterns of a "Good" Test Automation Framework, Locators & Data
Agile Testing Alliance
 

Similar to Shift-Left Testing: QA in a DevOps World by David Laulusa (20)

PPTX
2016 10-04: tdd++: tdd made easier
Christian Hujer
 
PPTX
TDD Training
Manuela Grindei
 
PPT
Test Driven
Alex Chaffee
 
PDF
DSR Testing (Part 1)
Steve Upton
 
PPTX
Testing the Untestable
Mark Baker
 
PPTX
Tdd guide
Hanokh Aloni
 
PPT
Testcase design techniques final
shraavank
 
PPTX
TDD Best Practices
Attila Bertók
 
PDF
Introduzione allo Unit Testing
Stefano Ottaviani
 
PPT
Unit 2 Unit level testing.ppt
PerfectMe2
 
PPT
Testing
nazeer pasha
 
PDF
Unit Testing - The Whys, Whens and Hows
atesgoral
 
PPTX
Advance unittest
Reza Arbabi
 
PPTX
module5 notes on random zation techniques.pptx
smiritisms
 
PPTX
Random testing
Can KAYA
 
PDF
Test driven development
christoforosnalmpantis
 
PPTX
Testing As A Bottleneck - How Testing Slows Down Modern Development Processes...
TEST Huddle
 
PDF
Developer Tests - Things to Know (Vilnius JUG)
vilniusjug
 
PDF
Class9_SW_Testing_Strategies.pdf
FarjanaParvin5
 
PDF
TDD reloaded - JUGTAA 24 Ottobre 2012
Pietro Di Bello
 
2016 10-04: tdd++: tdd made easier
Christian Hujer
 
TDD Training
Manuela Grindei
 
Test Driven
Alex Chaffee
 
DSR Testing (Part 1)
Steve Upton
 
Testing the Untestable
Mark Baker
 
Tdd guide
Hanokh Aloni
 
Testcase design techniques final
shraavank
 
TDD Best Practices
Attila Bertók
 
Introduzione allo Unit Testing
Stefano Ottaviani
 
Unit 2 Unit level testing.ppt
PerfectMe2
 
Testing
nazeer pasha
 
Unit Testing - The Whys, Whens and Hows
atesgoral
 
Advance unittest
Reza Arbabi
 
module5 notes on random zation techniques.pptx
smiritisms
 
Random testing
Can KAYA
 
Test driven development
christoforosnalmpantis
 
Testing As A Bottleneck - How Testing Slows Down Modern Development Processes...
TEST Huddle
 
Developer Tests - Things to Know (Vilnius JUG)
vilniusjug
 
Class9_SW_Testing_Strategies.pdf
FarjanaParvin5
 
TDD reloaded - JUGTAA 24 Ottobre 2012
Pietro Di Bello
 
Ad

More from QA or the Highway (20)

PDF
KrishnaToolComparisionPPT.pdf
QA or the Highway
 
PPTX
Ravi Lakkavalli - World Quality Report.pptx
QA or the Highway
 
PPTX
Caleb Crandall - Testing Between the Buckets.pptx
QA or the Highway
 
PDF
Thomas Haver - Mobile Testing.pdf
QA or the Highway
 
PDF
Thomas Haver - Example Mapping.pdf
QA or the Highway
 
PDF
Joe Colantonio - Actionable Automation Awesomeness in Testing Farm.pdf
QA or the Highway
 
PDF
Sarah Geisinger - Continious Testing Metrics That Matter.pdf
QA or the Highway
 
PDF
Jeff Sing - Quarterly Service Delivery Reviews.pdf
QA or the Highway
 
PDF
Leandro Melendez - Chihuahua Load Tests.pdf
QA or the Highway
 
PDF
Rick Clymer - Incident Management.pdf
QA or the Highway
 
PPTX
Robert Fornal - ChatGPT as a Testing Tool.pptx
QA or the Highway
 
PDF
Federico Toledo - Extra-functional testing.pdf
QA or the Highway
 
PPTX
Andrew Knight - Managing the Test Data Nightmare.pptx
QA or the Highway
 
PDF
Melissa Tondi - Automation We_re Doing it Wrong.pdf
QA or the Highway
 
PDF
Jeff Van Fleet and John Townsend - Transition from Testing to Leadership.pdf
QA or the Highway
 
PPTX
DesiradhaRam Gadde - Testers _ Testing in ChatGPT-AI world.pptx
QA or the Highway
 
PDF
Damian Synadinos - Word Smatter.pdf
QA or the Highway
 
PDF
Lee Barnes - What Successful Test Automation is.pdf
QA or the Highway
 
PPTX
Jordan Powell - API Testing with Cypress.pptx
QA or the Highway
 
PPTX
Carlos Kidman - Exploring AI Applications in Testing.pptx
QA or the Highway
 
KrishnaToolComparisionPPT.pdf
QA or the Highway
 
Ravi Lakkavalli - World Quality Report.pptx
QA or the Highway
 
Caleb Crandall - Testing Between the Buckets.pptx
QA or the Highway
 
Thomas Haver - Mobile Testing.pdf
QA or the Highway
 
Thomas Haver - Example Mapping.pdf
QA or the Highway
 
Joe Colantonio - Actionable Automation Awesomeness in Testing Farm.pdf
QA or the Highway
 
Sarah Geisinger - Continious Testing Metrics That Matter.pdf
QA or the Highway
 
Jeff Sing - Quarterly Service Delivery Reviews.pdf
QA or the Highway
 
Leandro Melendez - Chihuahua Load Tests.pdf
QA or the Highway
 
Rick Clymer - Incident Management.pdf
QA or the Highway
 
Robert Fornal - ChatGPT as a Testing Tool.pptx
QA or the Highway
 
Federico Toledo - Extra-functional testing.pdf
QA or the Highway
 
Andrew Knight - Managing the Test Data Nightmare.pptx
QA or the Highway
 
Melissa Tondi - Automation We_re Doing it Wrong.pdf
QA or the Highway
 
Jeff Van Fleet and John Townsend - Transition from Testing to Leadership.pdf
QA or the Highway
 
DesiradhaRam Gadde - Testers _ Testing in ChatGPT-AI world.pptx
QA or the Highway
 
Damian Synadinos - Word Smatter.pdf
QA or the Highway
 
Lee Barnes - What Successful Test Automation is.pdf
QA or the Highway
 
Jordan Powell - API Testing with Cypress.pptx
QA or the Highway
 
Carlos Kidman - Exploring AI Applications in Testing.pptx
QA or the Highway
 
Ad

Recently uploaded (20)

PPTX
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Software Development Company Keene Systems, Inc (1).pdf
Custom Software Development Company | Keene Systems, Inc.
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
[GDGoC FPTU] Spring 2025 Summary Slidess
minhtrietgect
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Software Development Company Keene Systems, Inc (1).pdf
Custom Software Development Company | Keene Systems, Inc.
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 

Shift-Left Testing: QA in a DevOps World by David Laulusa

  • 1. Shift-Left Testing QA in a DevOps World David Laulusa @dlaulusa Feb 25, 2020
  • 2. About Me • Brigham Young University, BS/EE • Princeton University, MS/EE • 20+ yrs in industry • Development/QA • Startups, Large Enterprises, Permanent/Contract • Telecommute • DevOpsDays Columbus
  • 11. You cannot inspect quality into a product. - Harold F. Dodge
  • 12. Inspection does not improve the quality, nor guarantee quality. Inspection is too late. The quality, good or bad, is already in the product. - William Deming
  • 13. Quality is not an act. It is a habit. - Aristotle
  • 14. Agenda • Testing Principles • Testing Partners • Test
  • 22. Continuous Delivery is the NEW Agile Satisfy the customer through early and continuous delivery of valuable software - Agile Manifesto
  • 29. Shift-Left Testing Static Unit Integration End-to-End Acceptance
  • 30. Bugs are cheaper when caught young. - Larry Smith
  • 34. Input Domain • The input domain contains all possible inputs. • Choose a finite set of values. • Include valid, invalid and special values • Include values that represent “normal use” (domain-specific knowledge) • Test selection is about sampling the input space in a cost-effective manner.
  • 36. Equivalence Classes • All members of an equivalence class contribute to the fault detection in the same way. • The combination of all equivalence classes must cover the entire domain. • Equivalence classes must not overlap. • Select one value from each Equivalence Class. • Choosing more than one value does not increase fault detection.
  • 37. Range • One class with values inside the range, and two with values outside the range. • If the range were 10 <= x <=20. 1.Equivalence Class 1: all numbers between 10 and 20, inclusive 2.Equivalence Class 2: all numbers less than 10 3.Equivalence Class 3: all numbers greater than 20 4.You could also do letters and special characters.
  • 38. String • At least one containing all legal strings and one containing all illegal strings. • For example, let fname: string be a variable to denote a first name. 1. Valid name {Sue} 2. Special characters {ε} 3. Number {7} 4. Too long {Too many characters so it would not be able to fit into the database}
  • 39. Enumeration • Each value in a separate class. • And then any other value. • For example, consider auto_color ∈ {red, green , blue}. • The following classes are generated, {{red}, {green}, {blue}, {blah}}
  • 40. Array • One class containing all legal arrays, one containing only the empty array, and one containing arrays larger than the expected size. • For example, consider int[] aName = new int [3]. • The following classes are generated: 1. {[]} 2. {[-10, 20]} 3. {[-9, 0, 12, 15]}
  • 42. Boundary-Value Analysis Programmers often make mistakes in processing values at and near the boundaries of equivalence classes. • min-1, min, min+1 • max-1, max, max+1 • 0, null, empty string
  • 44. Combinatorial Testing • Many defects only occur when a combination of inputs or events occur that interact with each other. • However, if you were to test every combination of inputs it may take years especially with today’s complex systems. • How do you choose which combination of inputs? • Combinatorial testing is a technique for reducing the number of test cases without drastically compromising functional coverage, in order to get more ‘bang for the buck’.
  • 45. Testing a System X (1,2) Y (Q,R) Z (5,6) System
  • 46. Combinatorial Testing Where T = 2, Pairwise Testing Test Case X Y Z TC1 1 Q 5 TC2 1 R 5 TC3 1 Q 6 TC4 1 R 6 TC5 2 Q 5 TC6 2 R 5 TC7 2 Q 6 TC8 2 R 6
  • 47. Test Case X Y Z TC1 1 Q 5 TC2 1 R 5 TC3 1 Q 6 TC4 1 R 6 TC5 2 Q 5 TC6 2 R 5 TC7 2 Q 6 TC8 2 R 6 Combinatorial Testing Where T = 2, Pairwise Testing
  • 48. Test Case X Y Z TC1 1 Q 5 TC2 1 R 5 TC3 1 Q 6 TC4 1 R 6 TC5 2 Q 5 TC6 2 R 5 TC7 2 Q 6 TC8 2 R 6 Combinatorial Testing Where T = 2, Pairwise Testing
  • 49. Combinatorial Testing Where T = 2, Pairwise Testing Test Case X Y Z TC1 1 Q 5 TC2 1 R 5 TC3 1 Q 6 TC4 1 R 6 TC5 2 Q 5 TC6 2 R 5 TC7 2 Q 6 TC8 2 R 6
  • 50. Combinatorial Testing Where T = 2, Pairwise Testing Test Case X Y Z TC1 1 Q 5 TC4 1 R 6 TC6 2 R 5 TC7 2 Q 6 TC8 2 R 6
  • 51. Combinatorial Testing Where T = 2, Pairwise Testing Test Case X Y Z TC1 1 Q 5 TC4 1 R 6 TC6 2 R 5 TC7 2 Q 6
  • 52. Combinatorial Testing Where T = 2, Pairwise Testing Test Case X Y Z TC1 1 Q 5 TC4 1 R 6 TC6 2 R 5 TC7 2 Q 6 • Going from 8 -> 4 isn’t that big a deal • Reducing # tests 50% is not that big a deal either • Reducing by hand is tedious
  • 53. Android Options Parameter Values HardKeyboardHidden No, Undefined, Yes KeyboardHidden No, Undefined, Yes Keyboard 12Key, NoKeys, Qwerty, Undefined NavigationHidden No, Undefined, Yes Navigation Dpad, NoNav, Trackball, Undefined, Wheel Orientation Landscape, Portrait, Square, Undefined ScreenLayout_Long Mask, No, Undefined, Yes ScreenLayout_Size Large, Mask, Normal, Small, Undefined TouchScreen Finger, NoTouch, Stylus, Undefined 3*3*4*3*5*4*4*5*4 = 172,800 combinations
  • 54. Combinatorial Testing to the Rescue T # Tests % of Total (172k) % Defects Found 2 29 0.02% 76% 3 137 0.08% 95% 4 625 0.4% 97% 5 2532 1.5% 99% 6 9168 5.3% 100% • The savings as a percentage of exhaustive testing depends on the number of parameters and the # of values for the parameters. • With larger systems the savings can be enormous
  • 55. “There’s an App for that” • AllPairs (perl) • PICT (Microsoft) • ACTS (NIST)
  • 56. When Not to Use Combinatorial Testing • When you really do have to test all combinations • This assumes a uniform distribution across all combinations. • Some combinations are more important than others. • Some combinations are impossible.
  • 57. T-Way - Effective in Finding Those Pesky Bugs 0 10 20 30 40 50 60 70 80 90 100 1 2 3 4 5 6 # Interacting Parameters Leading to Failure Browser Bugs (194) Server Bugs (171)
  • 58. Fly With Us – We found 90% of the defects!
  • 60. Dependency Injection In software engineering, dependency injection is a software design pattern that implements inversion of control for resolving dependencies. A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it.
  • 61. sub method { my $self = shift; my $obj = MyProject::Class->new(); my $x = $obj->get_something(); . . . return($x); }
  • 62. sub method { my $self = shift; my $obj = shift; my $x = $obj->get_something(); . . . return($x); }
  • 64. Grooming the Backlog • Make sure that there are sane completion requirements • Is it testable?
  • 67. Why Do We Unit Test? static OSStatus SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer signedParams, uint8_t *signature, UInt16 signatureLen) { OSStatus err; ... if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail; if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) goto fail; ... fail: SSLFreeBuffer(&signedHashes); SSLFreeBuffer(&hashCtx); return err; }
  • 68. Why Do We Unit Test? • It gives you confidence that your code works as you expect it to work. • Easily refactor your code to make it cleaner and more efficient. • Saves time because unit tests help prevent regressions from being introduced and released. • Once a bug is found, you can write a unit test for it, you can fix the bug, and the bug can never make it to production again because the unit tests will catch it in the future. (shift left testing) • Implicit documentation
  • 69. How Do We Unit Test? • Unit tests test units in isolation, in a dedicated, controlled environment. • Each unit test creates in own environment by instantiating only the classes needed to execute one test, putting them in a known state, then it invokes the method to be tested and verify the outcome. • This verification is done by assertions on the behavior of the method (as opposed to its implementation). • Performing the verification on the behavior and not on the implementation is important as this allows modifying the implementation without breaking the unit tests, and therefore using the unit tests as a safety net for the modification.
  • 70. What Do We Unit Test? • Generally a method. • Need to write tests for the public methods. • Could write tests for private methods, but it means you might have to re-write these tests when you re-factor. • No need to write tests for trivial setter/getters.
  • 71. Anatomy of a Unit Test • Set up all conditions for testing. • Call the method (or Trigger) being tested. • Verify that the results are correct. • Clean up modified records.
  • 72. Unit Tests • Make each test orthogonal (i.e., independent) to all the others • Don’t make unnecessary assertions • Test only one code unit at a time • Mock out all external services and state • Avoid unnecessary preconditions • Unit tests should ideally take less than 5 min to run. If it approaches 10 min, then we can break them up and run sets in parallel. • Unit tests will run each time code is checked in. • Builds cannot progress unless all unit tests pass.
  • 73. A Test is not a unit test if: • It talks to the database • It communicates across the network • It touches the file system • It can't run at the same time as any of your other unit tests • You have to do special things to your environment (such as editing config files) to run it.
  • 76. Test-Driven Development • write a failing test • write just enough code to make it pass • refactor the code to clean it up
  • 77. TDD • TDD is a design process, not a testing process. • Unit tests help to shape your design. • TDD is a robust way of designing software components (“units”) interactively so that their behavior is specified through unit tests. • TDD helps you to deliver software components that individually behave according to your design. • A suite of good unit tests is immensely valuable: it documents your design, and makes it easier to refactor and expand your code while retaining a clear overview of each component’s behavior.
  • 84. Code Coverage • Code coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs. • A program with high code coverage, measured as a percentage, has had more of its source code executed during testing which suggests it has a lower chance of containing undetected software bugs compared to a program with low code coverage.
  • 85. Code Coverage • Function coverage • Statement coverage • Branch coverage • Conditional coverage
  • 86. Code Coverage sub foo { my($x, $y) = @_; if ($x eq ‘string’ && $y < 10) { return 1; } else { return 0; } }
  • 90. Profiling Your Code Profiling is a form of dynamic program analysis that can measure things like: • memory usage • time complexity of a program • usage of particular instructions • frequency and duration of function calls
  • 91. Profiling Your Code • optimization • algorithm • loops • expensive function calls, including system calls • lazy building
  • 95. Acceptance Testing - Example Test Specification: • Free shipping a month before Christmas
  • 96. Test Code @Test public void orderLessThenAMonthBeforeChristmasShouldGiveZeroShipping() { Calendar purchaseDate = GregorianCalendar.getInstance(); purchaseDate.set(Calendar.YEAR, 2014); purchaseDate.set(Calendar.MONTH, Calendar.NOVEMBER); purchaseDate.set(Calendar.DAY_OF_MONTH, 24); int christmasEve = 24; int expectedShipping = 0; String expectedCurrency = “USD"; Date purchase = purchaseDate.getTime(); Shipping shipping = new Shipping(purchase, christmasEve); int actualCost = shipping.getCost(); assertThat(actualCost, is(expectedShipping)); }
  • 97. Cucumber - Layers Execute Specification (Gherkin) Step Definitions - Glue (47 languages) System Under Test
  • 98. Cucumber - Specification Scenario: Free shipping a month before Christmas Given a customer that Christmas is celebrated 24 of December When a customer buys a book on 2014-12-10 Then the shipping cost should be $0
  • 99. Cucumber - Step Definitions @When("^a customer buys a book on (.*)$") public void buyBook(@Format("yyyy-MM-dd") Date purchaseDate) throws Throwable { this.purchaseDate = purchaseDate; }
  • 102. Mutation Testing • White Box Testing • Mutate (change) certain statements in the source code and check if the test cases are able to find the errors. • This is called killing the mutant. Test suites are measured by the percentage of mutants that they kill. • New tests can be designed to kill additional mutants.
  • 104. Other Types of Testing • Security Testing • Performance Testing • Compliance Testing • Resiliency Testing
  • 113. Testing in Production • Logging • Server Monitoring • Application Performance Monitoring • Health Check
  • 115. TEST
  • 116. Burger World Burger: How Many?: Here: To Go: Lettuce: Tomato: Pickle: Onions: Mayo: Ketchup: Mustard: Instructions: Order Cancel