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

CI/CD & Quality Assurance · 2 hours · online

Testing the Configuration Space

How can we 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?

Mutation testingCombinatorial testingLayered test portfolioRings and compatibility windowsArtifact: Compatibility Matrix and Rollout Plan
Session objectives and structure

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, compose a layered test portfolio with reviewed AI-generated cases and plan a rollout by rings with verifiable stop and rollback criteria.

0Opening and retrieval poll10 min
10Concept briefing30 min
40Worked example15 min
55Break and groups5 min
60Applied lab in two parts40 min
100Debrief15 min
115Transfer and post-work5 min
The lab uses Tradeline, a fictional B2B ordering marketplace in five markets. Its bugs, files and numbers are synthetic and were written for this session, so that the discussion stays on the reasoning and away from any real system.
Retrieval from Workshop 2 and opening poll

Workshop 2 ended with a flag lifecycle policy and a Variant Debt Record. Each flag that stays on doubles the number of configurations the product can run in, which is the starting point of this session.

Retrieval · 3 min

What happens to the test matrix when a flag never expires?

In Workshop 2 the case repository had 40 flags, 12 of them on for more than six months. Answer in the chat in one sentence: which of those flags would you still have to test in both states today, and why.

Poll · 5 min

What share of last quarter's production bugs would adequate unit tests have prevented?

Options: less than 20%, 20 to 40%, 40 to 60%, more than 60%, or "we do not know". The last option is a legitimate answer, and the session returns to it when it discusses root cause analysis.

Keep the poll result visible. The three bugs of the lab are designed so that the class can compare its estimate with what the evidence shows.
Coverage measures execution, not detection

Line coverage reports which statements ran during the tests. It says nothing about whether a test would fail if those statements were wrong, which is the property that matters before a release.

Mutation testing

Inject small faults and see if the suite notices

The tool changes the code in small ways, such as < into <= or a constant into its neighbour, and runs the tests. A mutant that survives points to behaviour that no test pins down. The mutation score is the share of mutants killed.

Papadakis et al. (2019); Petrović & Ivanković (2018)
Analysis exclusions

What the quality gate does not look at

Exclusions in tools such as SonarQube remove paths from the coverage figure. They are useful for generated code and dangerous when they cover rules, adapters or anything with business logic, because the headline number stays high while that code goes unmeasured.

sonar.coverage.exclusions
Root cause analysis

Ask what kind of test would have failed

For each bug that reached production, the useful question is which layer would have caught it: unit, property, contract, isolation, migration or a rollout check. The answer tells the team where to invest, and it is often not the unit layer.

Petrović and Ivanković (2018) describe how Google surfaces surviving mutants during code review, limited to changed lines, so that developers act on them while the change is still fresh. Running mutation testing on a whole large codebase at every build tends to be too expensive.
AI in quality assurance, with review

Assistants can generate tests, suggest mutants and triage failures quickly. A generated test is code that someone approves, so it goes through the same review as any other change.

Useful uses

Where the assistant saves time

Drafting boundary cases from a written rule, proposing contract tests from an API schema, suggesting mutants for a function under review, grouping failed runs by probable cause and summarising a long log for the person on call.

What the reviewer checks

Typical problems in generated tests

Assertions that repeat the implementation instead of the specification, tests that pass without checking the expected behaviour, equality on floating-point money, fixtures with one configuration only, and test data copied from production with customer information.

A generated test that passes and proves little
def test_tax():
    assert tax_minor("co-andes", 150) == round(150 * 0.19)   # restates the code; never compares with the rule
A reviewed version compares the result with the written rule, for example tax rounded half up with decimal.Decimal, and runs it over many generated amounts.
The configuration space grows by multiplication

Each new factor multiplies the number of configurations. Testing all of them stops being possible long before the product feels complex to the people who build it.

Factor (Tradeline)LevelsCount
Tierbasic, plus, premium3
Region stampbr-south, mx-central, co-andes, za-north4
Integrationapp-only, erp-connector, orders-api3
Data modeshared-pool, dedicated-silo2
Optional featurescredit limit, loyalty, scheduled delivery, split payment (on/off)2⁴ = 16
Total3 × 4 × 3 × 2 × 161,152
Interaction rule

Most failures need few factors

Empirical studies summarised by Kuhn, Kacker and Lei (2013) found that the large majority of failures in the systems studied were triggered by the interaction of one or two factors, and that very few required more than six.

Covering array

Cover every pair, not every combination

A pairwise covering array contains every pair of levels of every two factors at least once. For this space, 12 to 16 configurations cover all 173 pairs.

A pipeline for many variants

When variation is resolved at runtime, one build serves every configuration. The pipeline then tests and promotes one artifact, and the configurations become test inputs instead of separate builds.

1Single build

One commit produces one artifact. No per-customer branch or per-region build.

2Immutable artifact

The same binary or image goes to every environment. Only configuration changes.

3Runtime configuration

Tier, region and features are read from tenant records and policies, and are versioned.

4Promotion

The artifact moves through stages; each stage adds evidence instead of rebuilding.

5Provenance

Signed provenance shows which source and which build produced what runs in production.

Continuous delivery

Humble and Farley (2010) describe the deployment pipeline as the path that every change follows, with the principle of building the binary only once and promoting it through the stages.

Humble & Farley (2010)
Supply chain

SLSA, from the OpenSSF, defines levels of assurance for build provenance, so that a team can show that the artifact in production came from the reviewed source.

OpenSSF (2023)
A layered portfolio instead of one end-to-end per variant

End-to-end tests are slow and brittle, and one per variant does not scale to a thousand configurations. Cheaper layers carry most of the coverage, and end-to-end tests check a few critical journeys.

LayerWhat it protects in a configurable productTradeline example
PropertyRules that must hold for any input of a policyTax rounded half up for any amount; minimum order is inclusive in every region
ContractThe agreement between a producer and each consumer, run on both sidesThe ERP invoice amount equals the order total, whatever the payment parts
Tenant isolationNo data, cache or quota crosses tenants in the shared poolA query with tenant A's context never returns rows of tenant B
MigrationOld and new application versions work with the schema during a deploymentVersion N-1 still writes orders after migration N runs
End-to-endA small number of critical journeysOrder with a delivery slot, paid in two parts, in Brazil
Vocke (2018) presents the test pyramid as a guide to the proportion of tests per layer, and Winters, Manshreck and Wright (2020) describe how Google sizes tests by scope and cost. Both point to the same practice: push each check down to the cheapest layer that can detect the defect.
Progressive delivery and compatibility

Some defects only appear in production, with real tenants and two versions running at once. Rings limit how many tenants a defect reaches, and compatibility rules let old and new versions coexist.

Rings and cohorts

Expose the change gradually

Internal tenants first, then a cohort chosen by stamp, tier or integration, then the rest. Each ring has an entry criterion, an automatic verification and a stop criterion measured on that cohort.

Deployment stamps

Independent copies of the stack

A stamp serves a group of tenants or a region. A release can move stamp by stamp, which limits the blast radius and gives natural rings.

Microsoft (2024)
Versioning and windows

Old and new contracts coexist

APIs and schemas change with expand and contract steps and a dated compatibility window. Stripe pins each consumer to a version and translates between versions in the server.

Leach (2017)
A stop criterion read only on the global dashboard can stay green while one cohort fails completely. The cohort metric has to be defined before the rollout starts, together with the threshold and the observation time.
Worked example: a well-covered Tradeline microservice

The orders service of Tradeline reports about 90% coverage and passes the quality gate. The facilitator runs the steps below live and makes each decision explicit.

1Read the headline

Coverage around 90%, quality gate green, new code above 80%.

2Run mutation testing

About 1,300 mutants and a score close to 40%. Most survivors sit in pricing and regional rules.

3Open the exclusions

sonar.coverage.exclusions removes regional rules and adapters from the figure.

4Generate a pairwise set

A small example with four factors, generated with a combinatorial testing tool.

5Compare

Pairs covered by the set against the configurations of the nightly suite.

sonar-project.properties (excerpt from the lab pack)
# Added in PR #4471: "exclude per-market config from coverage, it is just data"
sonar.coverage.exclusions=src/orders/rules/regional/**,src/orders/adapters/**
Groups, roles and materials for the lab

Groups of five or six participants in breakout rooms, for 40 minutes. Roles rotate at every workshop, so check who held each one in Workshop 2.

Lead

Keeps the discussion on the deliverable and decides when to move on.

Recorder

Fills the templates on the board or in the shared document.

Timekeeper

Ends Part 1 at 15 minutes and Part 2 at 40.

Skeptic

Asks for the evidence behind each claim and each configuration.

DownloadUsed in
bugs-pack.zipPart 1
configuration-space.csv, pairwise-output.csvPart 2
usage-by-configuration.csv, feature-adoption-by-region.csvPart 2, risk
regional-rules-policy.zipPart 2, Class 1
api-change-brief.md, templates.mdPart 2, rollout
No-login alternative: the full kit is a single zip on the session material page, and every output the lab needs (coverage, mutation results, pairwise set) is already generated in it. A spreadsheet and a shared document are enough.
Lab part 1 · Three bugs that reached production · 15 min

Each bug folder has the incident, the pull request history, the coverage report and the surviving mutants. The SonarQube configuration is at the root of the pack.

BUG-1 · co-andes

Minimum order blocks Colombian retailers

Carts at exactly the minimum value are rejected for three days after a refactoring described as "behaviour unchanged".

BUG-2 · mx-central, br-south

ERP invoices with the wrong amount

Distributors find under-invoiced orders at month-end reconciliation. Only some configurations are affected.

BUG-3 · za-north

Scheduled-delivery orders fail during a deploy

Checkout errors for 47 minutes while the global error rate stays below the rollback threshold.

For each bug, the group records
Root cause in one sentence · Would an adequate unit test have prevented it, and why · Preventive test, with its layer and what it asserts · Impact on the retailer · Impact on operations
Lab part 2 · Configurations, portfolio and rollout · 25 min

The Tradeline orders product combines 3 tiers, 4 regions, 3 integrations, 2 data modes and 4 optional features. The orders team must also release a breaking change to the Orders API.

ASize the space

Calculate the number of configurations and the number of pairs to cover.

BRead the pairwise set

Check pairwise-output.csv and add risk-based configurations with evidence from the usage files.

CBuild the portfolio

Assign checks to layers and ask an assistant for contract tests, then review what it produced.

DPlan the rollout

Rings, cohort stop criteria and compatibility window for the v2 change in api-change-brief.md.

EState readiness

Write a production readiness criterion that someone outside the group can verify.

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 verifiable rollback criterion.
The artifact: Compatibility Matrix and Rollout Plan

Both templates are in templates.md. The matrix states who can talk to whom during the transition; the plan states how the change reaches tenants and how it stops.

Compatibility Matrix
Consumerv1v2Supported until
ERP connectoryesring 0date
Distributor B (br-south)yesvendor releasedate
Small integratorsyesnoticesunset date
Rollout Plan
RingWhoCohort metricStop if
0internalcontract and reconciliationany difference
1first cohorterror rate of the cohortthreshold, time
2 and 3remaining stampsper consumerthreshold, time
Separate entitlements from release flags in the matrix. A tier or an entitlement stays as a permanent dimension of the product, while a release flag is a temporary state of the rollout and leaves the matrix when the rollout ends.
How each class works the lab

The case and the deliverable are the same for both classes. What changes is who leads each part and how deep the group goes into code.

Class 1 · developers

Contract and property tests in code

The group writes contract and property tests for the regional rules policy in regional-rules-policy.zip, which runs with Python and pytest. Some tests may fail against the current code: record the input that breaks the rule before changing anything. QA professionals lead the review of AI-generated tests.

Class 2 · architects, QA and SRE

Selection, portfolio and rings

QA professionals lead configuration selection and the test portfolio. SRE professionals lead the rings and the stop criteria, including the cohort metrics and the thresholds. Architects check the schema strategy of the API change.

In both classes, an assistant may draft the contract tests for the ERP invoice or for the Orders API v2. The group keeps a generated test only after someone explains which rule it checks and shows that it fails when the rule is broken, for example by running it against the bug in the pack.
Debrief and formative rubric

Groups compare the root causes they found, the configuration sets they chose and the rings they proposed. The rubric below 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, and AI-generated tests are reviewedOne end-to-end test per variant
RolloutRings, compatibility window and stop criteria definedSingle rollout to the whole base
Debrief questions: which bug would the poll answer have predicted correctly? Which risk-based configuration has the strongest evidence? Which stop criterion would have caught BUG-3?
Post-work and bridge to Workshop 4

The post-work applies the session to a real or hypothetical change in the participant's team. It takes about 20 minutes and feeds Project Development.

Post-work · 20 min

Minimum Compatibility Matrix and an effectiveness measure

Write a Minimum Compatibility Matrix for a real or hypothetical change, with the support window and the deprecation signal. Then compare coverage with a measure of test effectiveness, such as the mutation score, for one service of the team. Keep names of internal systems out of anything you share.

Workshop 4

Tenant-aware operations at scale

Rings and cohort stop criteria depend on seeing the product by tenant, cohort and stamp. Workshop 4 takes up observability, service level objectives by cohort and incident diagnosis when the global dashboard looks healthy.

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