BEES Functional Trainings · Engineering & Platform · Workshop 3 · Classes 1 and 2

Testing the Configuration Space

Reading material, pre-work, lab brief and lab kit for the CI/CD and Quality Assurance workshop. It explains how to measure the effectiveness of a test suite beyond coverage, how to select configurations when a product has more than a thousand of them, how to compose a test portfolio by layer and how to plan a rollout by rings with a compatibility window.

About this session

Testing the Configuration Space · Prof. Afonso

Learning objective

By the end of the session, participants should be able to measure the effectiveness of a test suite beyond coverage, select representative configurations from a large configuration space by combining pairwise coverage with risk, compose a layered test portfolio with reviewed AI-generated tests and plan the rollout of a breaking change by rings, with a compatibility window and verifiable stop and rollback criteria.

Session strategy

Two-hour online workshop following the standard structure of the program. A retrieval question and a poll open the session, a thirty-minute briefing presents test effectiveness, combinatorial explosion, the single-artifact pipeline, the layered portfolio and progressive delivery, and the facilitator works a live example on a well-covered microservice of Tradeline, a fictional marketplace with synthetic data. Groups of five or six with rotating roles then work a two-part lab: the root causes of three production bugs, and the selection of configurations, the test portfolio and the rollout plan for an API change. Class 1 also writes contract and property tests in code. A debrief compares the groups' answers and the session closes with the post-work.

Session structure

  1. Opening, retrieval from Workshop 2 and poll — 10 min
  2. Concept briefing: test effectiveness, configuration space, pipeline, layered portfolio and progressive delivery — 30 min
  3. Worked example: coverage, mutation score, exclusions and a pairwise set — 15 min
  4. Break and group formation — 5 min
  5. Applied lab, part 1: three bugs that reached production — 15 min
  6. Applied lab, part 2: configurations, portfolio and rollout plan — 25 min
  7. Debrief — 15 min
  8. Transfer: post-work and bridge to Workshop 4 — 5 min

1. How to use this material

This material accompanies Workshop 3 of the Engineering & Platform track of the BEES Functional Trainings, a two-hour online session for Classes 1 and 2. Its guiding question is how a team can know whether code is actually tested and ready for production, and keep delivery confidence, when the same product runs with several tiers, regions, integrations and configurations.

The material has three uses. Before the session, Section 2 contains the pre-work, which takes about fifteen minutes. During the session, Sections 3 to 8 develop the concepts of the briefing at a pace that the slides do not allow, and Sections 9 to 11 contain the lab brief, the downloads and the templates of the artifact. After the session, Section 13 describes the post-work, which applies the same reasoning to a change in the participant's own team.

The examples and the lab use Tradeline, a fictional global B2B ordering marketplace that connects manufacturers, distributors and retailers such as bars and small groceries in Brazil, Mexico, Colombia, South Africa and the Dominican Republic. Tradeline does not exist. Its bugs, files and numbers are synthetic and were written for this session, so that the discussion can focus on the reasoning without exposing any real system. Participants are welcome to bring comparable situations from their own work, described without confidential names.

Where this session sits in the track

Workshop 1 compared the mechanisms that absorb variation, such as configuration, entitlement and feature flag. Workshop 2 dealt with the debt that variation leaves behind, including flags that never expire. This workshop asks how a product with all that variation is tested and released, and Workshop 4 continues with how it is operated and observed by tenant.

2. Pre-work

The pre-work has two parts and takes about fifteen minutes. The first is the reading below, which summarises four ideas that the session assumes are familiar. The second is a short survey of the configuration dimensions of the product you work on, which you bring to the opening of the session.

2.1 Summary reading

Mutation testing evaluates a test suite by introducing small, deliberate faults in the code and running the tests against each faulty version. Each altered version is called a mutant, for instance a program in which a comparison < became <= or a constant was increased by one. When at least one test fails, the mutant is said to be killed; when every test still passes, it survives. The mutation score is the share of mutants killed, and a surviving mutant shows a precise piece of behaviour that no test pins down. Coverage cannot show this, because a line can be executed by a test whose assertions would not notice any change in that line (Papadakis et al., 2019).

Feature flags are switches that change the behaviour of a running system without a new deployment. Hodgson (2017) distinguishes release toggles, which hide unfinished work and should be short-lived, experiment toggles, operational toggles and permission toggles, which control what a group of users can access and may last for a long time. In the vocabulary of this program, a permanent commercial rule about who can use a capability is an entitlement, and a temporary switch used to release or test a change is a feature flag. The distinction matters for testing, because each long-lived toggle doubles the number of configurations in which the product can run.

Deployment rings expose a new version to groups of users in sequence. The first ring is usually internal, the next ones are cohorts chosen by region, tier or tolerance to risk, and the last one is the whole base. Each ring is a chance to observe the change with real traffic while the number of affected tenants is still small, provided that the team has defined in advance what it will measure and when it will stop.

Contract tests check the agreement between a service and each of its consumers, such as the fields, types and meaning of a response. In consumer-driven contracts, the consumer states what it relies on and the producer runs those expectations in its own pipeline, so that a change that breaks a consumer fails before release. Contract tests are much cheaper than end-to-end tests that start every system involved, which makes them suitable for products with many integrations (Vocke, 2018).

2.2 Survey of configuration dimensions

Write down, for the product or service you work on, the dimensions along which its behaviour varies: commercial tiers or plans, regions or markets, integrations with customers or partners, tenancy models, optional features and the flags that are currently on. For each dimension, note the number of levels and whether it is permanent (an entitlement or a contractual rule) or temporary (a release flag). Multiply the numbers of levels. The result is the size of your configuration space, and the session opens by comparing these numbers across participants. Use generic names and leave out confidential customer names.

3. Test effectiveness beyond coverage

Line and branch coverage report which statements and branches ran during the tests. The figure is useful to find code that no test executes, and that is the limit of what it can say. A test that calls a function and asserts nothing about its result adds coverage without adding protection, and a suite can therefore show a high percentage while missing the defects that matter. For this reason the question before a release should be whether the suite would detect a defect in the code it covers, which is what mutation testing estimates.

Mutation testing has a cost, since every mutant requires a test run. Petrović and Ivanković (2018) describe how Google made it usable at scale by generating mutants only for the lines changed in a code review, suppressing mutants in code where they rarely lead to useful tests, and presenting the surviving mutants to the author and the reviewers inside the review tool. The practical consequence for a team is that mutation testing does not need to run over the whole codebase at every build; it can run on changed code and on the modules where defects are most expensive, such as pricing, regional rules and integration adapters.

Quality tools add another source of distortion, the analysis exclusions. In SonarQube, for example, the property sonar.coverage.exclusions removes paths from the coverage calculation, and sonar.exclusions removes them from the analysis altogether. Exclusions are legitimate for generated code and fixtures. When they cover per-market rules or integration adapters, the quality gate stops looking at the code where variation lives, the headline coverage stays high and changes to that code are merged without any coverage requirement. Reading the exclusions is part of reading the coverage report.

The third practice is root cause analysis of the bugs that reached production. For each bug, the team asks which kind of test would have failed before the release: a unit test, a property test, a contract test, an isolation test, a migration test or a check during the rollout. The distribution of the answers shows where the investment in testing should go. If most bugs would have been caught by unit tests, the team needs better unit tests where the defects occur; if most come from interactions between configurations or from deployments, writing more unit tests will not change the result.

Worked example used in the session

The Tradeline orders service reports about 90% coverage and passes its quality gate. A mutation run on the same build kills about 40% of the mutants, and most survivors are in pricing and regional rules. The SonarQube configuration shows why: the regional rules and the adapters were excluded from coverage months earlier, in a pull request that described them as "just data".

4. The configuration space

A configurable product runs in as many configurations as the product of the numbers of levels of its factors. The Tradeline orders product has three tiers, four region stamps, three integration modes, two data modes and four optional features that can be on or off, which gives 3 × 4 × 3 × 2 × 2⁴ = 1,152 configurations. Running the whole test suite in every configuration is impossible in a pipeline that must finish in minutes, and choosing a few configurations by habit, such as the default configuration of each region, leaves untested exactly the combinations that customers with more features use.

FactorLevelsKind
tierbasic, plus, premiumCommercial rule (entitlement), permanent
regionbr-south, mx-central, co-andes, za-northRegulatory and infrastructure; br-south issues a fiscal invoice for every order
integrationapp-only, erp-connector, orders-apiHow the distributor receives and confirms orders
data_modeshared-pool, dedicated-siloTenancy model of the database
credit_limit, loyalty_points, scheduled_deliveryoff, onEntitlements, permanent
split_paymentoff, onRelease flag, rollout in progress

Combinatorial testing offers a principled way out. Kuhn, Kacker and Lei (2013) summarise empirical studies of failures in several kinds of software and report that most failures were triggered by a single factor or by the interaction of two, that the share decreased quickly as the number of interacting factors grew, and that no failure in the systems studied required more than six. If most failures need at most two factors, a test set that contains every pair of levels of every two factors at least once will exercise most of the interactions that cause them. Such a set is called a pairwise covering array.

The number of pairs to cover in the Tradeline space is 173, and a covering array for them has 12 to 16 configurations instead of 1,152. No covering array can have fewer than 12 rows here, because the two largest factors, region and tier, form 4 × 3 = 12 pairs that must each appear in a different configuration. Tools such as Microsoft PICT, ACTS from NIST or libraries in common languages generate these arrays. The lab provides one already generated, in pairwise-output.csv, with 14 configurations checked to cover all pairs.

A covering array treats all pairs as equally important, which they are not. The second step is to add configurations chosen by risk: the region with a regulatory requirement, the integration that carries most orders, the tenancy model of the largest customers and the combinations that appear in the incident history. These additions require evidence, and the lab provides synthetic usage and incident data for that purpose. The final set is the pairwise array plus a small number of risk-based configurations, each with a stated reason.

The factor list also has to separate permanent dimensions from temporary ones. A tier or an entitlement remains part of the product and stays in the matrix. A release flag is a state of a rollout, and the configuration matrix should treat it as something that will disappear; otherwise every flag that is never removed becomes a permanent factor that doubles the space, which is the flag debt discussed in Workshop 2.

5. A pipeline for many variants

Testing a configurable product is only manageable when variation is resolved at runtime and the pipeline produces a single artifact. Humble and Farley (2010) describe the deployment pipeline as the automated path that every change follows from commit to release, and one of its principles is to build the binaries only once and promote the same artifact through every stage. If each region or customer had its own branch or its own build, every configuration would be a separate product with its own pipeline, and the test effort would grow with the number of builds.

With a single build, the configurations become inputs of the tests. The artifact is immutable, the tier, region and features of each tenant are read from records and policies that are versioned like code, and each stage of promotion adds evidence about the same artifact: unit and property tests at commit, contract tests at merge, the configuration set in an integration stage and the rings in production. When a defect appears in one configuration, the team can reproduce it by running the same artifact with that configuration.

The supply chain of the artifact is part of the same concern. SLSA, the Supply-chain Levels for Software Artifacts framework maintained by the OpenSSF, defines levels of assurance for how an artifact was built and for the provenance that records it, so that a team can show that what runs in production came from reviewed source through a known build (OpenSSF, 2023). In a product released stamp by stamp over several days, provenance also answers the operational question of which version each stamp is running.

6. A layered test portfolio

The intuitive answer to a large configuration space is to run end-to-end tests in each configuration, and it does not scale. End-to-end tests start several systems, depend on test environments that are often unstable and take minutes each, so one test per variant multiplies the slowest and most fragile part of the suite. Vocke (2018) presents the test pyramid as a guide to keep many fast tests at the bottom and few broad tests at the top, and Winters, Manshreck and Wright (2020) describe how Google classifies tests by size, according to the resources they use, and keeps most of them small. In a configurable product, the practice is to push each check down to the cheapest layer able to detect the defect.

LayerWhat it protectsExample in the Tradeline case
UnitLogic of one function or class, including boundariesA cart exactly at the minimum order value is accepted in each region and tier
PropertyRules that must hold for every input of a policyTax rounded half up equals the result of decimal.Decimal for any amount
ContractWhat each consumer relies on in a producer's interfaceThe amount of the ERP invoice equals the order total, whatever the payment parts
Tenant isolationNo data, cache or quota crosses tenants in a shared poolA query issued with tenant A's context never returns tenant B's rows
Migration and compatibilityOld and new versions of the application work with the schema during a deploymentVersion N-1 still writes orders after migration N has run
End-to-endA few critical journeysAn order with a delivery slot, paid in two parts, in Brazil

Property tests are especially suited to policies, such as the regional rules of a marketplace, because the rules are stated as invariants: the minimum order is inclusive, the total with tax never decreases when the cart grows, amounts are always integers in minor units. A property-based testing tool, such as Hypothesis in Python, generates many inputs, checks the invariant and reduces a failing input to the simplest one it can find. Contract tests protect integrations, and they are the layer that catches defects caused by a change on one side of an interface that is correct in isolation. Isolation and migration tests address risks that exist only because the product is multi-tenant and deployed gradually, and they rarely appear in a test suite unless someone asks for them explicitly.

7. Progressive delivery and compatibility

Some defects appear only in production, with real tenants, real data volumes and two versions of the software running at the same time. Progressive delivery accepts this and limits how many tenants a defect can reach before it is detected. A release moves through rings, each ring has an entry criterion and an automatic verification, and the deployment stops on its own when a stop criterion is met. Deployment stamps, which are independent copies of the application stack serving a group of tenants or a region, provide natural boundaries for these rings (Microsoft, 2024).

The stop criterion has to be measured on the cohort that receives the change. A global error rate averages the affected cohort with the rest of the traffic, so a failure that hits every order of a small cohort can stay below a global threshold. In the Tradeline lab, one of the bugs follows exactly this pattern. The criterion is defined before the rollout starts, with the metric, the threshold, the observation time and the rollback action, so that the decision to stop does not depend on someone noticing a dashboard.

Compatibility is the condition that lets old and new versions coexist during the rollout. For database schemas, the usual pattern is expand and contract: first add the new structure while keeping the old one, then write to both, migrate the data, move reads to the new structure and remove the old one only in a later release, when no running version uses it. For APIs, the producer keeps the old contract for a compatibility window and signals its end in advance. Leach (2017) describes how Stripe pins each account to the API version it first used and translates responses between versions inside the server, so that breaking changes reach consumers only when they choose to upgrade. The window, the signal and the date of removal are written down in the Compatibility Matrix, the first part of the artifact of this session.

8. AI in quality assurance

Assistants and coding agents can draft tests from a written rule, propose contract tests from an API schema, suggest mutants for a function under review, group failed runs by probable cause and summarise long logs. These uses save time in a configurable product, where the number of cases to write is large. They also introduce a specific risk: a generated test can look complete and still prove very little.

The most frequent problems are assertions that restate the implementation instead of the specification, tests that pass without checking the behaviour that matters, equality comparisons on floating-point money, fixtures built for a single configuration and test data copied from production with customer information. A generated test is code that a person approves, so it goes through the same review as any other change. A simple check during review is to break the rule on purpose, for example by reintroducing the defect from the bug pack, and confirm that the test fails.

A generated test that passes and proves little, and a reviewed version
# generated: restates the code, so it can never disagree with it
def test_tax():
    assert tax_minor("co-andes", 150) == round(150 * 0.19)

# reviewed: compares with the written rule over many amounts
from decimal import Decimal, ROUND_HALF_UP
def test_tax_rounds_half_up():
    for amount in range(1, 100_000):
        expected = int((Decimal(amount) * Decimal("0.19")).quantize(Decimal(1), rounding=ROUND_HALF_UP))
        assert tax_minor("co-andes", amount) == expected, amount

9. Lab brief

The lab takes forty minutes in groups of five or six participants, in two parts. Each group has a lead, a recorder, a timekeeper and a skeptic, whose role is to ask for the evidence behind each claim. Roles rotate at every workshop.

Part 1 · Three bugs that reached production (15 minutes)

Each group receives three bugs of the Tradeline orders service. Every bug folder contains the incident description, the history of the pull requests that touched the code, an excerpt of the coverage report and the surviving mutants of the mutation run. The SonarQube configuration of the repository is at the root of the pack. For each bug, the group identifies the root cause, states whether an adequate unit test would have prevented it and why, proposes the preventive test with its layer and assertion, and estimates the impact on the retailer and on operations.

Part 2 · Configurations, portfolio and rollout (25 minutes)

The Tradeline orders product combines 3 tiers, 4 regions, 3 integrations, 2 data modes and 4 optional features. The group calculates the size of the space, analyses the pairwise set in pairwise-output.csv, which covers every pair of levels, and adds configurations chosen by risk with evidence from usage-by-configuration.csv and feature-adoption-by-region.csv. It then assigns the checks of the product to the layers of a test portfolio, asks an approved AI assistant to propose contract tests and reviews what was generated. Finally, it plans the rollout of the breaking change to the Orders API described in api-change-brief.md, with rings, a compatibility window and automatic stop criteria.

The deliverable is complete when each bug has a root cause and a preventive test, the chosen configurations cover the highest-risk interactions and the rollout has a rollback criterion that someone outside the group can verify.

Differentiation by class

In Class 1, the group also writes contract and property tests for the regional rules policy in regional-rules-policy.zip, a small Python module that runs with pytest; some of these tests may fail against the current code, and the group records the input that breaks the rule before changing anything. QA professionals lead the review of AI-generated tests. In Class 2, QA professionals lead configuration selection and the portfolio, SRE professionals lead the rings and the stop criteria, and architects review the schema strategy of the API change.

No-login alternative

If the collaborative board, the repository or the assistant is not available, the group works from the full kit zip in Section 10 with a spreadsheet and a shared document. Every output the lab needs, such as coverage, mutation results and the pairwise set, is already generated in the kit, and the templates are in templates.md.

10. Lab kit and downloads

All files are synthetic and refer to the fictional Tradeline marketplace. The full kit contains every file listed below in a single zip.

FileContentUsed in
configuration-space-lab-kit.zipEvery file of the lab in one archiveNo-login alternative
bugs-pack.zipThree bugs with incident, pull request history, coverage, surviving mutants and the SonarQube configurationPart 1
configuration-space.csvFactors, levels and kind of each dimensionPart 2
pairwise-output.csv14 configurations covering all 173 pairs of levelsPart 2
usage-by-configuration.csvOrders, incidents and GMV share by tier, region, integration and data mode in the last quarterPart 2, risk
feature-adoption-by-region.csvShare of tenants with each optional feature on, by region, and the type of flagPart 2, risk
regional-rules-policy.zipPython policy module with example tests and its written specificationPart 2, Class 1
api-change-brief.mdBreaking change from Orders API v1 to v2, consumers and constraintsPart 2, rollout
templates.mdTemplates of the five tables of the labParts 1 and 2

11. Templates of the artifact

The artifact of the session is the Compatibility Matrix and Rollout Plan. The two tables below are its core; the full set of templates, including the root cause table and the test portfolio, is in templates.md.

Compatibility Matrix

Producer versionConsumerv1 contractv2 contractSchema versionSupported untilDeprecation signal
 
 

Rollout Plan

RingWho (stamp, tier, cohort, tenants)Entry criterionAutomatic verification (cohort metric)Stop criterion (threshold and time)Rollback action
0
1
2
3

The plan closes with a production readiness criterion written as conditions that someone outside the team can verify, for example the contract suite that must be green, the reconciliation result that must hold for a given period in ring 0 and the stop criteria that must be configured in the deployment tool.

12. Formative rubric

The rubric guides the debrief and the feedback of the facilitator. It is formative, and nobody receives a grade.

CriterionProficientDeveloping
Effectiveness and coverageSuite effectiveness measured beyond coverage, and combinatorial selection complemented by riskCoverage treated as proof of quality, or configurations chosen arbitrarily
PortfolioTest layers reduce reliance on end-to-end tests, and AI-generated tests are reviewedOne end-to-end test per variant
RolloutRings, compatibility window and stop criteria definedSingle rollout to the whole base

13. Post-work

The post-work takes about twenty minutes and applies the session to a real or hypothetical change in your team. Write a Minimum Compatibility Matrix for that change, with the support window of the old version and the deprecation signal that consumers will receive. Then choose one service of your team and compare its coverage with a measure of test effectiveness, such as the mutation score on its most critical module, and note what the difference suggests about where tests are missing. Use generic names for internal systems and customers in anything you share with the class.

The matrix is reused in Project Development, and the next session, Workshop 4, builds on the rings and cohort stop criteria defined here when it takes up observability and operations by tenant.

14. References

  • HODGSON, P. Feature toggles (aka feature flags). martinfowler.com, 2017. Available at: https://martinfowler.com/articles/feature-toggles.html.
  • HUMBLE, J.; FARLEY, D. Continuous delivery. Boston: Addison-Wesley, 2010.
  • KUHN, D. R.; KACKER, R. N.; LEI, Y. Introduction to combinatorial testing. Boca Raton: CRC Press, 2013.
  • LEACH, B. APIs as infrastructure: future-proofing Stripe with versioning. Stripe Blog, 2017. Available at: https://stripe.com/blog/api-versioning.
  • MICROSOFT. Architect multitenant solutions on Azure. Azure Architecture Center, 2024. Available at: https://learn.microsoft.com/azure/architecture/guide/multitenant/overview.
  • OPENSSF. SLSA: Supply-chain Levels for Software Artifacts, specification v1.0. Open Source Security Foundation, 2023.
  • PAPADAKIS, M.; KINTIS, M.; ZHANG, J.; JIA, Y.; LE TRAON, Y.; HARMAN, M. Mutation testing advances: an analysis and survey. Advances in Computers, vol. 112, pp. 275-378, 2019.
  • PETROVIĆ, G.; IVANKOVIĆ, M. State of mutation testing at Google. In: International Conference on Software Engineering: Software Engineering in Practice, 40., 2018. Proceedings. ACM, 2018. pp. 163-172.
  • VOCKE, H. The practical test pyramid. martinfowler.com, 2018. Available at: https://martinfowler.com/articles/practical-test-pyramid.html.
  • WINTERS, T.; MANSHRECK, T.; WRIGHT, H. Software engineering at Google: lessons learned from programming over time. Sebastopol: O'Reilly, 2020.