Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Category Partitioning: Introducing TDD Through ...

migliaci
January 18, 2019

Category Partitioning: Introducing TDD Through Automation and Analysis

Introducing test-driven development to delivery-focused software development teams provides a unique set of challenges. For example, how to begin the process of deciding what to test? As a Software Engineering Coach tasked with improving software development practices across a large enterprise, I've been hard at work tackling this very problem. The solution I found is simple: describe the requirements, then let automation do most of the work!

Category partitioning (or category partition testing) is a testing methodology based on input/output analysis that emphasizes both coverage and error detection. Combining manual design and automated test generation, the systematic nature of this method takes a lot of the guesswork and anxiety out of deciding how to begin building out a TDD suite for teams starting out.

In this session, I will walk through a sample application of the category partitioning method centered around the development of a simple application, including all of the steps of the method: identifying independently testable features, splitting features into categories, partitioning categories into choices, identifying constraints and boundary conditions, and finally generating a suite of test frames through an automated tool that could be used to begin development using TDD.

migliaci

January 18, 2019

Transcript

23 slides
  1. Let’s Talk TDD • Testing methodology in which requirements are

    analyzed and turned into test cases before code is written. • The code is then written to make the tests pass.
  2. Benefits of TDD • Requirements are understood fully, leading to

    higher quality code. • Tests will exist for each implemented feature, increasing developer confidence (vital for CI/CD). • Good design is required up front.
  3. Challenges in TDD • Requirements analysis can lead to paralysis

    on what to test / how to test it. • Lots of time/cognitive load spent up-front on test design. • Intimidating for development teams or teams working in new domains.
  4. Category Partitioning • Developed by T.J. Ostrand and M.J. Balcer

    in 1988 (before TDD was commonplace)! • Focuses on analyzing system specifications based on requirements, and translating them into test cases via automation.
  5. System Specification • System specification contains details about the system.

    • First step is to break this down into functional units. • This maps nicely to individual endpoints...
  6. Parameters • Input into functional unit. Maps directly to endpoint

    parameters! • One example: value of {id}.
  7. Flow of C.P. Method Test Specification (categories, choices, constraints) Test

    Frames (automatically generated) Test Scripts (describe test frames in code)
  8. Categories • Major properties or characteristics • Examples include: format

    of {id} parameter, presence in database, status of database.
  9. Choices • Potential values of each category. • Examples include:

    whether the value of {id} is properly formatted, whether the database is available, whether the id is present in the database.
  10. Example Test Spec Format of Id: • Valid format •

    Invalid format Id present in Database: • Yes • No Database Status: • Available • Unavailable
  11. Constraints • Restrictions on choices. • Automated tool will pair

    up all choices and generate a maximum number of test frames. • We don’t need to test valid id input if database is down. • See the problem? Need to reduce them.
  12. Example Test Spec Format of Id: • Valid format [property

    formatValid] • Invalid format [single] Id present in Database: • Yes [if formatValid] • No [if formatValid] Database Status: • Available • Unavailable [error]
  13. Test Frame Generation • Done via automated tool • Syntax

    covered in demonstration. • https://github.com/alexorso/tslg enerator
  14. ◇ There are no stupid ones… ◇ Follow @AngstyGaijin on

    Twitter if you want to know more. 4 QUESTIONS

More Decks by migliaci

Other Decks in Technology