SlideShare a Scribd company logo
1 of 36
Download to read offline
Model-Driven Testing
  for Agile Teams
      Kerry Kimbrough
      Cornutum Project
This Workshop Is About...
• A design technique...
  – Input space modeling

• Using a tool...
  – Tcases, a model-driven test case generator

• To tackle test design issues...
Test Design Issues
• How do I pick test cases?
  – Define an input model. Then generate test
    cases.
• How many test cases do I need?
  – Define a coverage model. Then generate a
    minimal test set.
• Are my tests good enough?
  – Is my input model good enough?
  – Is my coverage model good enough?
Why Does It Matter?
• Defects are a drag!
  – The friction that slows delivery

• The Agile way
  – Test early
  – Test continuously

• And yet...
The Curse of the Undone

 Sprint’s done!                  Except for fixing
                    Umm, sure
Stories finished?                  the defects!




          Product    Dev        QA
The Busted Sprint

 We planned 3
stories, but only     We had a lot of stuff to fix
   finished 2?            up in the 1st story.




          Product    Dev                 QA
The Sprint That Never Was

 We planned 2       We had to work on those
stories, but only    production problems!
  finished 1??




          Product   Dev                QA
The Hardening (?!) Sprint

Stories done! Can    Almost. Just have to finish
we release now?         the hardening sprint!




          Product   Dev                 QA
Why Model-Driven Testing?
• Much more powerful tests
• For little or no extra effort
• At every step of the way
  – Before dev
  – During dev
  – During system test
Tcases: How To Get It
      www.cornutum.org




                     See “Installing Tcases”




      Download it here
Example: find <pattern> <file>
Locates one or more instances of a given pattern in a
text file.
All lines in the file that contain the pattern are written to
standard output. A line containing the pattern is written
only once, regardless of the number of times the
pattern occurs in it.
The pattern is any sequence of characters whose
length does not exceed the maximum length of a line
in the file. To include a blank in the pattern, the entire
pattern must be enclosed in quotes. To include a
quotation mark in the pattern, two quotes in a row ("")
must be used.
Modeling The Input Space




• All combinations of values
• For each dimension of variation
Defining System Functions
<System name=“Examples”
  <!-- All system function definitions go here -->

  <Function name=“find”
    <!-- All input definitions for “find” go here -->
  </Function>

</System>
Defining Input Variables
<Function name="find“>
  <Input type="arg">
    <!--arg: Direct input arguments (the default)-->
    <Var name="fileName">
      ...
    </Var>
    ...
  </Input>
  <Input type="env">
    <!--env: Environment state variables-->
    ...
  </Input>
</Function>
Defining Input Values
<Function name=“find”
  <Input type=“arg”>
    <Var name=“fileName”
       <!-- The required file name is defined -->
       <Value name=“defined”/>
       <!-- The required file name is missing: an error -->
       <Value name=“missing” failure=“true”/>
    </Var>
    ...
  </Input>
</Function>
To Define Input Values...
• Enumerate all values
• Or identify “equivalence classes”
  – A subset of values that are “test-equivalent”
  – No need to test all -- any one will do
  – Examples
     • Integer: Negative, Zero, Positive
     • Bounded: Below-Min, In-Range, Above-Max
     • List: Empty, One, Many
Modeling Complex Inputs
find <pattern> <file>



All lines in the file that contain the pattern are written to
standard output. A line containing the pattern is written only
once, regardless of the number of times the pattern occurs
in it.
Defining Variable Sets
<VarSet name="file">
  <!-- Does the file exist? -->
  <Var name="exists"> ... </Var>
  <!-- Does the file contain... -->
  <VarSet name="contents">
    <!-- ... any matching lines? -->
    <Var name="patterns"> ... </Var>
    <!-- ... multiple matches in a line? -->
    <Var name="patternsInLine"> ... </Var>
  </VarSet>
</VarSet>
Modeling Complex Inputs
find <pattern> <file>




The pattern is any sequence of characters whose length
does not exceed the maximum length of a line in the file. To
include a blank in the pattern, the entire pattern must be
enclosed in quotes. To include a quotation mark in the
pattern, two quotes in a row ("") must be used.
Defining Variable Sets
<VarSet name="pattern">

 <!-- How many chars in pattern? -->
 <Var name="size"> ... </Var>

 <!-- Is it quoted? -->
 <Var name="quoted"> ... </Var>

 <!-- Does it contain blanks? -->
 <Var name="blanks"> ... </Var>

 <!-- Does it contain embedded quotes? -->
 <Var name="embeddedQuotes"> ... </Var>

</VarSet>
System Input Model Basics
<System ...> <!-- A system has...                      -->
 <Function ...> <!-- functions, having...              -->
  <Input ...>    <!-- different types of inputs:       -->
   <Var ...>      <!-- simple variables, having...     -->
    <Value ...> ...</Value> <!-- (classes of) values   -->
   </Var>
   <VarSet ...> <!-- or complex inputs, composed of...-->
    <Var ...> ...</Var>       <!-- many variables...  -->
    <VarSet ...> ...</VarSet> <!-- and many levels    -->
   </VarSet>
  </Input>
 </Function>
</System>
Defining Constraints
• Values can have properties
  – Assumed by any test case that includes this
    value
• Values can have conditions
  – Properties that must appear in any test case
    that includes this value.
  – Properties that must not appear in any test
    case that includes this value.
When Variables Are Irrelevant
<Function name="find">
 <Input type="arg">

  <VarSet name="pattern" when="fileExists">

   <Var name="blanks" whenNot="empty">
     ...
   </Var>
   ...
  </VarSet>

   ...
 </Input>
 ...
</Function>
Input Model vs. Coverage Model
• Input model
  – Defines the input space
  – Defines the input combinations possible

• Coverage model
  – Defines the input combinations tested
What Is Input Space Coverage?
• Measures input combinations tested
• A “black box” coverage metric
  – Specification-based
• Complement to “white box” coverage
  – Code-based
  – Measures lines/branches/conditions tested
• Basic unit: an N-tuple
  – Combination of values from N input variables
Default: 1-Tuple Coverage
<TestCase id="2">
<Input type="arg">
 <Var name="pattern.size" value="manyChars"/>
 <Var name="pattern.quoted" value="yes"/>
 <Var name="pattern.blanks" value="many"/>
 <Var name="pattern.embeddedQuotes" value="none"/>
 <Var name="fileName" value="defined"/>
</Input>
<Input type="env">
 <Var name="file.exists" value="yes"/>
 <Var name="file.contents.linesLongerThanPattern" value="many"/>
 <Var name="file.contents.patterns" value="one"/>
 <Var name="file.contents.patternsInLine" value="one"/>
</Input>
</TestCase>
2-Tuple (Pairwise) Coverage
<TestCase id="2">
<Input type="arg">
 <Var name="pattern.size" value="manyChars"/>
 <Var name="pattern.quoted" value="yes"/>
 <Var name="pattern.blanks" value="many"/>
 <Var name="pattern.embeddedQuotes" value="none"/>
 <Var name="fileName" value="defined"/>
</Input>
<Input type="env">
 <Var name="file.exists" value="yes"/>
 <Var name="file.contents.linesLongerThanPattern" value="many"/>
 <Var name="file.contents.patterns" value="one"/>
 <Var name="file.contents.patternsInLine" value="one"/>
</Input>
</TestCase>
Failures From Multiple Factors




    Source: NIST http://csrc.nist.gov/groups/SNS/acts
Example: Web-Client.Config
<Function name="Config">
 <!-- Set up the configuration for a Web client test -->
 <Input>
  <Var name="Browser">
   <Value name="Firefox"/>
   <Value name="Chrome"/>
  </Var>
  <Var name="OS">
   <Value name="Linux"/>
   <Value name="Windows"/>
   <Value name="Mac-OS-X"/>
  </Var>
  <Var name="Flash">
   <Value name="Yes"/>
   <Value name="No"/>
  </Var>
 </Input>
</Function>
Example: Web-Client.Config
• Default coverage (1-tuple)
  – 7 tuples
  – 3 test cases
• 2-tuple coverage
  – 16 tuples
  – 6 test cases (minimum)
• All permutations
  – 12 tuples
  – 12 test cases
Tool Tips: Use Tcases To...
• Define multiple coverage levels

• Reuse and extend previous test cases

• Create random combinations

• Simplify tests with once=“true”

• Transform test case output
Model-Driven Testing Workflow


     Define            Build




              Verify
Model-Driven Testing Workflow


     Define



                Example use cases:
                Explore and clarify
                with high-level
                system input model
Model-Driven Testing Workflow


                           Build




Unit tests: Generate and
improve with detailed
unit input models
Model-Driven Testing Workflow


      System tests: Generate coverage
      for system configuration space



             Verify
The End

Done?           Done!        Hell, yeah!




    Product     Dev     QA

More Related Content

What's hot

Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Samyak Bhalerao
 
Das Frontend richtig Testen – mit Jest @Developer Week 2018
Das Frontend richtig Testen – mit Jest @Developer Week 2018Das Frontend richtig Testen – mit Jest @Developer Week 2018
Das Frontend richtig Testen – mit Jest @Developer Week 2018Holger Grosse-Plankermann
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineGil Fink
 
Automated Testing in Django
Automated Testing in DjangoAutomated Testing in Django
Automated Testing in DjangoLoek van Gent
 
Making friends with TDD
Making friends with TDDMaking friends with TDD
Making friends with TDDJohn Cleary
 
BDD style Unit Testing
BDD style Unit TestingBDD style Unit Testing
BDD style Unit TestingWen-Tien Chang
 
Python testing using mock and pytest
Python testing using mock and pytestPython testing using mock and pytest
Python testing using mock and pytestSuraj Deshmukh
 
Unit Test Your Database
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your DatabaseDavid Wheeler
 
Refactoring Ruby Code
Refactoring Ruby CodeRefactoring Ruby Code
Refactoring Ruby CodeCaike Souza
 
(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014
(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014
(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014istefo
 
PgTAP Best Practices
PgTAP Best PracticesPgTAP Best Practices
PgTAP Best PracticesDavid Wheeler
 
Describe's Full of It's
Describe's Full of It'sDescribe's Full of It's
Describe's Full of It'sJim Lynch
 
Test driven development with react
Test driven development with reactTest driven development with react
Test driven development with reactLeon Bezuidenhout
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffJAX London
 
Tests and Testability: Apex Structure and Strategy
Tests and Testability: Apex Structure and StrategyTests and Testability: Apex Structure and Strategy
Tests and Testability: Apex Structure and StrategySalesforce Developers
 
How Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran MizrahiHow Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran MizrahiRan Mizrahi
 
Migration strategies 4
Migration strategies 4Migration strategies 4
Migration strategies 4Wenhua Wang
 

What's hot (20)

Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...
 
Das Frontend richtig Testen – mit Jest @Developer Week 2018
Das Frontend richtig Testen – mit Jest @Developer Week 2018Das Frontend richtig Testen – mit Jest @Developer Week 2018
Das Frontend richtig Testen – mit Jest @Developer Week 2018
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
Automated Testing in Django
Automated Testing in DjangoAutomated Testing in Django
Automated Testing in Django
 
Testing in Django
Testing in DjangoTesting in Django
Testing in Django
 
Making friends with TDD
Making friends with TDDMaking friends with TDD
Making friends with TDD
 
BDD style Unit Testing
BDD style Unit TestingBDD style Unit Testing
BDD style Unit Testing
 
Python testing using mock and pytest
Python testing using mock and pytestPython testing using mock and pytest
Python testing using mock and pytest
 
Unit Test Your Database
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your Database
 
Refactoring Ruby Code
Refactoring Ruby CodeRefactoring Ruby Code
Refactoring Ruby Code
 
(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014
(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014
(Unit) Testing in Emberjs – Munich Ember.js Meetup July 2014
 
PgTAP Best Practices
PgTAP Best PracticesPgTAP Best Practices
PgTAP Best Practices
 
Describe's Full of It's
Describe's Full of It'sDescribe's Full of It's
Describe's Full of It's
 
Test driven development with react
Test driven development with reactTest driven development with react
Test driven development with react
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
 
Tests and Testability: Apex Structure and Strategy
Tests and Testability: Apex Structure and StrategyTests and Testability: Apex Structure and Strategy
Tests and Testability: Apex Structure and Strategy
 
Karma - JS Test Runner
Karma - JS Test RunnerKarma - JS Test Runner
Karma - JS Test Runner
 
Java 8 ​and ​Best Practices
Java 8 ​and ​Best PracticesJava 8 ​and ​Best Practices
Java 8 ​and ​Best Practices
 
How Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran MizrahiHow Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran Mizrahi
 
Migration strategies 4
Migration strategies 4Migration strategies 4
Migration strategies 4
 

Viewers also liked

TAEE2012-Putting Fundmentals of Electronic Circuits Practices online
TAEE2012-Putting Fundmentals of Electronic Circuits Practices onlineTAEE2012-Putting Fundmentals of Electronic Circuits Practices online
TAEE2012-Putting Fundmentals of Electronic Circuits Practices onlineMohamed Tawfik
 
Adecuación. Berta.
Adecuación. Berta.Adecuación. Berta.
Adecuación. Berta.mvaldesr
 
Don L. Rondeau - Federal Air Marshall Letter of Appreciation
Don L. Rondeau - Federal Air Marshall Letter of Appreciation Don L. Rondeau - Federal Air Marshall Letter of Appreciation
Don L. Rondeau - Federal Air Marshall Letter of Appreciation Don L Rondeau
 
Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014
Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014
Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014Atenea tech
 
3 1 impatto_ambientale_vezzoli_2013-14
3 1 impatto_ambientale_vezzoli_2013-143 1 impatto_ambientale_vezzoli_2013-14
3 1 impatto_ambientale_vezzoli_2013-14LeNS_slide
 
Chad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from VenusChad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from Venus360|Conferences
 
Mydent -E health
Mydent -E healthMydent -E health
Mydent -E healthmydent1
 
Ss instruments & diagnostic sets (pdf)
Ss instruments & diagnostic sets (pdf)Ss instruments & diagnostic sets (pdf)
Ss instruments & diagnostic sets (pdf)Sarwar Son's®
 
El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones
El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones
El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones Cátedra Banco Santander
 
Tendencias 2014: El desafío de la privacidad en Internet
Tendencias 2014: El desafío de la  privacidad en Internet Tendencias 2014: El desafío de la  privacidad en Internet
Tendencias 2014: El desafío de la privacidad en Internet ESET Latinoamérica
 
Unnim: Experiencia en Medios Sociales
Unnim: Experiencia en Medios SocialesUnnim: Experiencia en Medios Sociales
Unnim: Experiencia en Medios Socialeshbatalla
 
Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)
Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)
Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)Celine van Erp
 
Nextext (english vesion)
Nextext (english vesion)Nextext (english vesion)
Nextext (english vesion)Nextext
 
Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...
Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...
Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...Jose Carlos Diaz
 
Mainline Functional Verification of IBM's POWER7 Processor Core
Mainline Functional Verification of IBM's POWER7 Processor CoreMainline Functional Verification of IBM's POWER7 Processor Core
Mainline Functional Verification of IBM's POWER7 Processor CoreDVClub
 
Cartas
CartasCartas
Cartaszdany
 

Viewers also liked (20)

TAEE2012-Putting Fundmentals of Electronic Circuits Practices online
TAEE2012-Putting Fundmentals of Electronic Circuits Practices onlineTAEE2012-Putting Fundmentals of Electronic Circuits Practices online
TAEE2012-Putting Fundmentals of Electronic Circuits Practices online
 
Adecuación. Berta.
Adecuación. Berta.Adecuación. Berta.
Adecuación. Berta.
 
Don L. Rondeau - Federal Air Marshall Letter of Appreciation
Don L. Rondeau - Federal Air Marshall Letter of Appreciation Don L. Rondeau - Federal Air Marshall Letter of Appreciation
Don L. Rondeau - Federal Air Marshall Letter of Appreciation
 
Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014
Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014
Contratos y presupuestos en proyectos Drupal - Drupal Camp Spain 2014
 
3 1 impatto_ambientale_vezzoli_2013-14
3 1 impatto_ambientale_vezzoli_2013-143 1 impatto_ambientale_vezzoli_2013-14
3 1 impatto_ambientale_vezzoli_2013-14
 
Chad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from VenusChad Udell - Developers are from Mars, Designers are from Venus
Chad Udell - Developers are from Mars, Designers are from Venus
 
Mydent -E health
Mydent -E healthMydent -E health
Mydent -E health
 
Cirrculum_Vitae
Cirrculum_VitaeCirrculum_Vitae
Cirrculum_Vitae
 
CIPR Social Summer - Phil Hakim
CIPR Social Summer - Phil HakimCIPR Social Summer - Phil Hakim
CIPR Social Summer - Phil Hakim
 
Ss instruments & diagnostic sets (pdf)
Ss instruments & diagnostic sets (pdf)Ss instruments & diagnostic sets (pdf)
Ss instruments & diagnostic sets (pdf)
 
Contacto imelda
Contacto imeldaContacto imelda
Contacto imelda
 
El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones
El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones
El eportafolio Maharazar en la Universidad de Zaragoza. Incipientes reflexiones
 
Tendencias 2014: El desafío de la privacidad en Internet
Tendencias 2014: El desafío de la  privacidad en Internet Tendencias 2014: El desafío de la  privacidad en Internet
Tendencias 2014: El desafío de la privacidad en Internet
 
Unnim: Experiencia en Medios Sociales
Unnim: Experiencia en Medios SocialesUnnim: Experiencia en Medios Sociales
Unnim: Experiencia en Medios Sociales
 
Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)
Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)
Yumeko presentatie E-commerce Event CB 13-09-12 (Stephan Zeijlemaker)
 
Nextext (english vesion)
Nextext (english vesion)Nextext (english vesion)
Nextext (english vesion)
 
Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...
Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...
Simulation & CBTs: Mixing traditional CBT and low cost simulation in the same...
 
Mainline Functional Verification of IBM's POWER7 Processor Core
Mainline Functional Verification of IBM's POWER7 Processor CoreMainline Functional Verification of IBM's POWER7 Processor Core
Mainline Functional Verification of IBM's POWER7 Processor Core
 
Pia
Pia Pia
Pia
 
Cartas
CartasCartas
Cartas
 

Similar to Model-Driven Testing For Agile Teams

Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott NottinghamAutomated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott NottinghamPuppet
 
Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2nottings
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passageErik Rose
 
Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019
Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019
Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019Mail.ru Group
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingMark Rickerby
 
Test in action week 2
Test in action   week 2Test in action   week 2
Test in action week 2Yi-Huan Chan
 
JavaScript Robotics
JavaScript RoboticsJavaScript Robotics
JavaScript RoboticsAnna Gerber
 
Unit Test in Ruby on Rails by Minitest
Unit Test in Ruby on Rails by MinitestUnit Test in Ruby on Rails by Minitest
Unit Test in Ruby on Rails by MinitestHosang Jeon
 
DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)Steve Upton
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)Jen Wong
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHPvinaikopp
 
Agile db testing_techniques
Agile db testing_techniquesAgile db testing_techniques
Agile db testing_techniquesTarik Essawi
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classesyoavwix
 
Rspec Tips
Rspec TipsRspec Tips
Rspec Tipslionpeal
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform ResearchVasil Remeniuk
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform researchVasil Remeniuk
 

Similar to Model-Driven Testing For Agile Teams (20)

Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott NottinghamAutomated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
 
Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2
 
TDD Training
TDD TrainingTDD Training
TDD Training
 
Scala test
Scala testScala test
Scala test
 
Scala test
Scala testScala test
Scala test
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passage
 
Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019
Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019
Оформление пайплайна в NLP проекте​, Виталий Радченко. 22 июня, 2019
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe Testing
 
Test in action week 2
Test in action   week 2Test in action   week 2
Test in action week 2
 
JavaScript Robotics
JavaScript RoboticsJavaScript Robotics
JavaScript Robotics
 
Unit Test in Ruby on Rails by Minitest
Unit Test in Ruby on Rails by MinitestUnit Test in Ruby on Rails by Minitest
Unit Test in Ruby on Rails by Minitest
 
DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
 
Agile db testing_techniques
Agile db testing_techniquesAgile db testing_techniques
Agile db testing_techniques
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
 
Rspec Tips
Rspec TipsRspec Tips
Rspec Tips
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 

Model-Driven Testing For Agile Teams

  • 1. Model-Driven Testing for Agile Teams Kerry Kimbrough Cornutum Project
  • 2. This Workshop Is About... • A design technique... – Input space modeling • Using a tool... – Tcases, a model-driven test case generator • To tackle test design issues...
  • 3. Test Design Issues • How do I pick test cases? – Define an input model. Then generate test cases. • How many test cases do I need? – Define a coverage model. Then generate a minimal test set. • Are my tests good enough? – Is my input model good enough? – Is my coverage model good enough?
  • 4. Why Does It Matter? • Defects are a drag! – The friction that slows delivery • The Agile way – Test early – Test continuously • And yet...
  • 5. The Curse of the Undone Sprint’s done! Except for fixing Umm, sure Stories finished? the defects! Product Dev QA
  • 6. The Busted Sprint We planned 3 stories, but only We had a lot of stuff to fix finished 2? up in the 1st story. Product Dev QA
  • 7. The Sprint That Never Was We planned 2 We had to work on those stories, but only production problems! finished 1?? Product Dev QA
  • 8. The Hardening (?!) Sprint Stories done! Can Almost. Just have to finish we release now? the hardening sprint! Product Dev QA
  • 9. Why Model-Driven Testing? • Much more powerful tests • For little or no extra effort • At every step of the way – Before dev – During dev – During system test
  • 10. Tcases: How To Get It www.cornutum.org See “Installing Tcases” Download it here
  • 11. Example: find <pattern> <file> Locates one or more instances of a given pattern in a text file. All lines in the file that contain the pattern are written to standard output. A line containing the pattern is written only once, regardless of the number of times the pattern occurs in it. The pattern is any sequence of characters whose length does not exceed the maximum length of a line in the file. To include a blank in the pattern, the entire pattern must be enclosed in quotes. To include a quotation mark in the pattern, two quotes in a row ("") must be used.
  • 12. Modeling The Input Space • All combinations of values • For each dimension of variation
  • 13. Defining System Functions <System name=“Examples” <!-- All system function definitions go here --> <Function name=“find” <!-- All input definitions for “find” go here --> </Function> </System>
  • 14. Defining Input Variables <Function name="find“> <Input type="arg"> <!--arg: Direct input arguments (the default)--> <Var name="fileName"> ... </Var> ... </Input> <Input type="env"> <!--env: Environment state variables--> ... </Input> </Function>
  • 15. Defining Input Values <Function name=“find” <Input type=“arg”> <Var name=“fileName” <!-- The required file name is defined --> <Value name=“defined”/> <!-- The required file name is missing: an error --> <Value name=“missing” failure=“true”/> </Var> ... </Input> </Function>
  • 16. To Define Input Values... • Enumerate all values • Or identify “equivalence classes” – A subset of values that are “test-equivalent” – No need to test all -- any one will do – Examples • Integer: Negative, Zero, Positive • Bounded: Below-Min, In-Range, Above-Max • List: Empty, One, Many
  • 17. Modeling Complex Inputs find <pattern> <file> All lines in the file that contain the pattern are written to standard output. A line containing the pattern is written only once, regardless of the number of times the pattern occurs in it.
  • 18. Defining Variable Sets <VarSet name="file"> <!-- Does the file exist? --> <Var name="exists"> ... </Var> <!-- Does the file contain... --> <VarSet name="contents"> <!-- ... any matching lines? --> <Var name="patterns"> ... </Var> <!-- ... multiple matches in a line? --> <Var name="patternsInLine"> ... </Var> </VarSet> </VarSet>
  • 19. Modeling Complex Inputs find <pattern> <file> The pattern is any sequence of characters whose length does not exceed the maximum length of a line in the file. To include a blank in the pattern, the entire pattern must be enclosed in quotes. To include a quotation mark in the pattern, two quotes in a row ("") must be used.
  • 20. Defining Variable Sets <VarSet name="pattern"> <!-- How many chars in pattern? --> <Var name="size"> ... </Var> <!-- Is it quoted? --> <Var name="quoted"> ... </Var> <!-- Does it contain blanks? --> <Var name="blanks"> ... </Var> <!-- Does it contain embedded quotes? --> <Var name="embeddedQuotes"> ... </Var> </VarSet>
  • 21. System Input Model Basics <System ...> <!-- A system has... --> <Function ...> <!-- functions, having... --> <Input ...> <!-- different types of inputs: --> <Var ...> <!-- simple variables, having... --> <Value ...> ...</Value> <!-- (classes of) values --> </Var> <VarSet ...> <!-- or complex inputs, composed of...--> <Var ...> ...</Var> <!-- many variables... --> <VarSet ...> ...</VarSet> <!-- and many levels --> </VarSet> </Input> </Function> </System>
  • 22. Defining Constraints • Values can have properties – Assumed by any test case that includes this value • Values can have conditions – Properties that must appear in any test case that includes this value. – Properties that must not appear in any test case that includes this value.
  • 23. When Variables Are Irrelevant <Function name="find"> <Input type="arg"> <VarSet name="pattern" when="fileExists"> <Var name="blanks" whenNot="empty"> ... </Var> ... </VarSet> ... </Input> ... </Function>
  • 24. Input Model vs. Coverage Model • Input model – Defines the input space – Defines the input combinations possible • Coverage model – Defines the input combinations tested
  • 25. What Is Input Space Coverage? • Measures input combinations tested • A “black box” coverage metric – Specification-based • Complement to “white box” coverage – Code-based – Measures lines/branches/conditions tested • Basic unit: an N-tuple – Combination of values from N input variables
  • 26. Default: 1-Tuple Coverage <TestCase id="2"> <Input type="arg"> <Var name="pattern.size" value="manyChars"/> <Var name="pattern.quoted" value="yes"/> <Var name="pattern.blanks" value="many"/> <Var name="pattern.embeddedQuotes" value="none"/> <Var name="fileName" value="defined"/> </Input> <Input type="env"> <Var name="file.exists" value="yes"/> <Var name="file.contents.linesLongerThanPattern" value="many"/> <Var name="file.contents.patterns" value="one"/> <Var name="file.contents.patternsInLine" value="one"/> </Input> </TestCase>
  • 27. 2-Tuple (Pairwise) Coverage <TestCase id="2"> <Input type="arg"> <Var name="pattern.size" value="manyChars"/> <Var name="pattern.quoted" value="yes"/> <Var name="pattern.blanks" value="many"/> <Var name="pattern.embeddedQuotes" value="none"/> <Var name="fileName" value="defined"/> </Input> <Input type="env"> <Var name="file.exists" value="yes"/> <Var name="file.contents.linesLongerThanPattern" value="many"/> <Var name="file.contents.patterns" value="one"/> <Var name="file.contents.patternsInLine" value="one"/> </Input> </TestCase>
  • 28. Failures From Multiple Factors Source: NIST http://csrc.nist.gov/groups/SNS/acts
  • 29. Example: Web-Client.Config <Function name="Config"> <!-- Set up the configuration for a Web client test --> <Input> <Var name="Browser"> <Value name="Firefox"/> <Value name="Chrome"/> </Var> <Var name="OS"> <Value name="Linux"/> <Value name="Windows"/> <Value name="Mac-OS-X"/> </Var> <Var name="Flash"> <Value name="Yes"/> <Value name="No"/> </Var> </Input> </Function>
  • 30. Example: Web-Client.Config • Default coverage (1-tuple) – 7 tuples – 3 test cases • 2-tuple coverage – 16 tuples – 6 test cases (minimum) • All permutations – 12 tuples – 12 test cases
  • 31. Tool Tips: Use Tcases To... • Define multiple coverage levels • Reuse and extend previous test cases • Create random combinations • Simplify tests with once=“true” • Transform test case output
  • 32. Model-Driven Testing Workflow Define Build Verify
  • 33. Model-Driven Testing Workflow Define Example use cases: Explore and clarify with high-level system input model
  • 34. Model-Driven Testing Workflow Build Unit tests: Generate and improve with detailed unit input models
  • 35. Model-Driven Testing Workflow System tests: Generate coverage for system configuration space Verify
  • 36. The End Done? Done! Hell, yeah! Product Dev QA