Module 8 · Information Systems · Lesson 9 · Week 9

Instruction session · Thursday, December 3, 2026 · 25 minutes of exposition, then each student works alone · in-class graded activity

Automated Testing

Which tests does a DataApp need? The quality attributes that the partner depends on answer the question. In this session each student derives them with the ATAM: a utility tree, quality attribute scenarios in six parts, test cases traced to each scenario, and a pytest suite whose results return to the tree as risks and tradeoffs.

pytestArrange, Act, AssertATAMUtility treeSix-part scenariosTraceability⚖️ Graded in class

Project ritual

Daily · 15 minutes

Each group reports the progress of its deliverables, the work planned for this session and the blockers that require a decision.

15:00
What I didWhat I will doBlockersProgress
Agenda · two hours
A short exposition, then seven steps done alone

The professor presents the method in 25 minutes, with the reference applied to the package of Lesson 7. From 0:40 on, each student applies the six steps of the method to the DataApp of the group and then puts its tests in a pipeline of git.inteli.edu.br, with the CREATE prompts of the lab and a coding agent, while the professor circulates.

0:15 · expositionTests and pytestProfessorWhy automate; levels of test; AAA, fixtures, parametrize, markers
0:25 · expositionThe ATAMProfessorDrivers, utility tree, six-part scenarios, risks and tradeoffs; the reference
0:40 · steps 01–03From drivers to scenariosEach studentDrivers and attributes, utility tree, scenarios in six parts
1:10 · steps 04–05Test cases and testsEach studentTest cases traced to scenarios; the suite implemented and run
1:45 · step 06Results into the treeEach studentRisks, non-risks, sensitivity points, tradeoffs
1:55 · step 07The GitLab pipelineEach student.gitlab-ci.yml, the merge request and the schedule; delivery
Where the work happensIn the repository of the group, on the DataApp packaged in Lesson 7. The reference is lab/lesson-9/tcg_dataapp/: the same package of Lesson 7 with the six documents of the method, 29 tests, the two runs recorded and .gitlab-ci.yml. The lab of the session replays the seven steps in the browser, with the pipelines recorded on 12/11/2026.
0:15 · Why automated tests
Why a DataApp needs automated tests

A DataApp runs every day without a person. Each claim that someone checked once by reading a result (the grain holds, a rerun duplicates nothing, a frozen report never changes) must become code that checks it at every change, or it stops being true without anyone noticing.

Regression

What worked keeps working

The nine tests of Lesson 7 run in two seconds at every change; a change that breaks the idempotent load fails before it reaches the main branch.

Specification

The test states the rule

test_a_month_with_two_captures_freezes_only_the_last is the semi-additive rule of Lesson 6, written so that a machine can check it.

Design

Testable code is decoupled code

The fake source of the tests exists because the ETL layer receives its client as a parameter; a layer that opened the network by itself could not be tested offline.

The question of this sessionLesson 7 wrote tests for the behaviours the professor remembered. Which behaviours does the partner depend on, and which of them are tested? The ATAM answers this question systematically.
0:18 · Levels of test
Levels of test, from one function to the whole run

The test pyramid orders the tests by the size of what they exercise. The lower the level, the faster the test and the more precisely a failure points to its cause; the higher the level, the closer the test is to what the user sees.

LevelExercisesIn the reference packageTime
unitone function, without I/Oorder() rejects a cycle; freeze_month rejects a month that is not YYYY-MMmilliseconds
integrationone layer with a real DuckDB in memorya batch loaded twice is replaced; the gates of check_goldtens of ms
contractthe shape of an output that others readthe Parquet marts against docs/contracts/marts.jsontenths of a second
end to endthe whole pipeline with a fake sourcea full run, a rerun, a source down, a renamed fieldtenths of a second
performancea measure of time under a given volume100,000 synthetic prices from build_gold to write_reportabout 1.3 s
A data pipeline also tests its dataThe quality gates of Lesson 7 are tests that run in production on every run; the tests of this session check that those gates stop the run when they must.
0:21 · pytest
pytest: Arrange, Act, Assert, fixtures and markers

Each test prepares a situation, performs one action and checks its outcome. pytest finds the functions named test_*, injects the fixtures they ask for and reports each failure with the values that differed.

tests/scenarios/test_correctness.py
@pytest.mark.scenario("S04")                      # marker
def test_s04_renamed_price_field_stops_the_run(settings):  # fixture
    """TC04.1 a renamed price field stops the run"""
    prices = copy.deepcopy(PRICES)                # Arrange
    for rows in prices["2026-09-01"].values():
        for r in rows:
            r["market_price"] = r.pop("marketPrice")
    ctx = pipeline.run(settings,                  # Act
                       client=FakeClient(prices=prices))
    assert "check_quality" in ctx.results["_failed"]   # Assert
ResourceUse
fixturethe environment of the scenario: settings with a temporary folder; no_network, applied to every test
parametrizethe same test over several stimuli
markerscenario("S04") ties the test to its scenario
monkeypatchreplaces the clock or an environment variable
--junitxmlthe report that a CI server reads
0:25 · The ATAM
The ATAM in six steps, from drivers to findings

The Architecture Tradeoff Analysis Method, of the Software Engineering Institute, evaluates an architecture against the quality attributes that its business drivers require. This session condenses it into six steps, each one producing a file of the repository.

01Business driverswhat the partner needs; the quality attributes that follow
02Utility treeattributes, refinements and leaves rated (I,D)
03Scenarioseach leaf in six parts, with a measurable response
04Test caseseach scenario as one to three verifiable cases
05Testseach case as a pytest function, run on the code as it is
06Findingsrisks, non-risks, sensitivity points and tradeoffs
What changes in relation to an ATAM with stakeholdersThe original method gathers architects and stakeholders for days and evaluates by analysis. Here the analysis is checked by execution: a scenario whose response is not measured by a test stays a hypothesis.
0:28 · Utility tree
Leaves rated by importance and difficulty

The root is the utility of the system. Each leaf is a concrete scenario rated twice, from H to L: how much the business drivers depend on it, and how hard it is for the architecture to achieve it. Leaves rated (H,H) and (H,M) are analysed and tested first.

docs/utility_tree.md of the reference (14 leaves)
Utility
├── Correctness
│   ├── Idempotent runs ................ S01 (H,M)
│   ├── No wrong number published ...... S02 (H,M)
│   ├── Every price reaches the model .. S03 (H,M)
│   ├── Schema drift of the source ..... S04 (H,H)
│   └── Semi-additive measure .......... S05 (H,H)
├── Reliability
│   ├── Transient failure of the source  S06 (H,L)
│   └── Source down for the whole run .. S07 (H,M)
├── Auditability ....................... S08 (H,L) S09 (M,L)
├── Interoperability · contract ........ S10 (M,L)
├── Timeliness · stale data ............ S11 (M,L)
├── Performance · budget ............... S12 (M,M)
├── Testability · offline .............. S13 (M,L)
└── Modifiability · configuration ...... S14 (L,L)
DriverNeed
BD1a wrong number costs more than a late one
BD2the frozen report is cited after the month
BD3the source has no service level
BD4runs daily, unattended, on modest hardware
BD5the model changes every sprint
0:31 · Quality attribute scenario
Six parts, ending in a measure that a test can check

A leaf of the tree is still a sentence. The scenario makes it precise: who causes what, in which part of the system and in which state, what the system does, and how that response is measured.

Source

tcgcsv.com

Stimulus

is down during the whole run

Artifact

pipeline.py and cli.py

Environment

unattended daily run after a successful run

Response

the run fails naming the task, skips its dependents and leaves what was published

Response measure

exit code 1; no new row in db_ingestion; out/report.md byte-identical

S07 of the reference, (H,M)The measure has three verifiable conditions, so the scenario yields two test cases: TC07.1 runs the pipeline with a source that always fails and compares the report byte by byte; TC07.2 runs the command and checks the exit code.
0:33 · Traceability
Scenario, test case, test function, result

Every test traces to one scenario, and every scenario to its tests. A marker makes the link part of the code, so the suite itself prints which scenarios pass, fail or have no test.

pytest · end of the output
============== ATAM traceability ==============
S01  (H,M)  Correctness · Idempotent runs                    2/2  PASS
S02  (H,M)  Correctness · No wrong number published          2/2  PASS
S03  (H,M)  Correctness · Every price reaches the model      2/2  PASS
S04  (H,H)  Correctness · Schema drift of the source         2/2  PASS
S05  (H,H)  Correctness · Semi-additive measure              1/1  PASS
S06  (H,L)  Reliability · Transient failure of the source    1/1  PASS
S07  (H,M)  Reliability · Source down for the whole run      2/2  PASS
  ...
S14  (L,L)  Modifiability · Sets by configuration            1/1  PASS
suite time 8.78 s
29 passed in 8.77s
PieceRole
docs/scenarios.tomlthe single source of the scenarios
@pytest.mark.scenario("S07")the link from the test to the scenario
docstring TC07.1 …the id of the test case
plugin in conftest.pyrefuses an unknown id, prints the table, writes out/traceability.json
pytest --scenario S07runs one scenario
tools/traceability.pythe utility tree with the results
0:35 · Findings
What the results say about the architecture

The ATAM does not end in a list of passed tests. Each result is read back into the tree and classified, so that the next decision of the team is based on the risks it found and on the tradeoffs it accepted.

Risk

A decision that may prevent a response

The inner join of gold.fact_price drops a price whose product is not in the catalogue, and no check notices (S03).

Non-risk

A decision shown to be sound

Reading the JSON by field name makes a new field of the source change no number (S04, TC04.2).

Sensitivity point

A parameter on which a response depends

The timestamp of noon UTC decides what is the same batch; another hour breaks the idempotency of S01.

Tradeoff

One attribute improves, another worsens

A stricter quality gate publishes fewer wrong numbers and causes more failed runs: correctness against availability (S02 to S04).

0:37 · The reference · first run
The package of Lesson 7 failed 5 of 29 tests

The scenarios were written and tested against the package of Lesson 7 as it was, without any fix. Three scenarios failed, and each failure named a risk that the nine tests of Lesson 7 did not reach.

ScenarioResult on 0.1.0What the failure showedChange in 0.3.0
S03 (H,M) every price reaches the modelFAIL 0/2a price without product disappears in the join; the check fact_without_set could never faillanding and fact compared per capture; above 1 % the run stops
S04 (H,H) schema driftFAIL 1/2a renamed marketPrice publishes a report without that capture, and the run ends OKmore than 10 % null prices in a capture stops the run
S11 (M,L) stale dataFAIL 0/2nothing reports the age of the last capturetcg-dataapp freshness, exit code 1 above 2 days
24 · 29 of 29tests passed on 0.1.0 and on 0.3.0, offline, in 9 to 17 s
0 · 1.7 %prices lost and largest share of null prices in the real data, below the limits of 1 % and 10 %
1.3 s100,000 prices from build_gold to write_report; budget of S12: 10 s
0:40 · Now alone · ⚖️ graded in class
Seven steps on the DataApp of your group

From this point each student works alone, on the DataApp packaged in Lesson 7, with the seven prompts of the lab and a coding agent. The next seven slides hold the prompts; each step produces a file of the repository and ends with a condition to check before moving on.

How to work
  • start from a green suite: pip install -e '.[dev]' and pytest
  • one prompt per step, adapted to the data of the partner
  • the reference in lab/lesson-9/tcg_dataapp/ shows the form, not the content
  • run the tests on the code as it is before fixing anything
The graded activity
  • the statement is the DAG and Testing Activity on Adalove
  • individual work on a branch graded-activity/student-name
  • a Prefect pipeline (Lesson 8) and the tests of the six steps, documented in a pull request, which on git.inteli.edu.br is a merge request with the pipeline of step 07
  • only the link is submitted, by Friday, 04/12
Time boxesSteps 01 and 02 until 0:55; step 03 until 1:10; steps 04 and 05 until 1:45; step 06 until 1:55; step 07, the pipeline, until the end. A scenario left without six parts at 1:10 stays in the tree, rated, for step 06.

Step 01 · 0:40 · Drivers · alone

Business drivers and quality attributes

What does the partner need from the DataApp, and which qualities follow from it? The answer comes from the code and the documents of the partner, and each attribute must cite the driver that justifies it.

Produces

docs/business_drivers.md: four to six drivers (BD1, BD2…) and the quality attributes, each with its meaning for this DataApp.

Done when
  • Does each driver state a need and its consequence for the architecture?
  • Does each attribute cite at least one driver?
  • Are the hypotheses marked as such?
Prompt 01 · CREATE
[C] Character
You are a software architect who runs the ATAM (Architecture Tradeoff
Analysis Method) on a data application. The application is the DataApp of
my group, packaged in Lesson 7 in three layers (views, processors, etls),
in the folder of this repository.

[R] Request
1. Read the README, pyproject.toml, the pipeline and the gold layer of the
   package, and summarise in five lines what the DataApp does, for whom,
   from which source and how often it runs.
2. Write docs/business_drivers.md with four to six business drivers
   (codes BD1, BD2, ...). Each driver states a need of the partner or of
   the users and its consequence for the architecture.
3. In the same file, list the quality attributes that follow from the
   drivers (correctness, reliability, auditability, interoperability,
   timeliness, performance, testability, modifiability, security...),
   each with one sentence on what it means for THIS DataApp and the codes
   of the drivers that justify it.

[E] Example
| BD3 | The source is a free public mirror without a service level, which
can fail, lag or change its fields without notice. | Failures of the
source are expected events, handled by retries, gates and checks of
freshness. |

[A] Adjustments
- Use what is in the code and in the partner documents; do not invent a
  requirement. When a driver is a hypothesis, write "(hypothesis, to
  confirm with the partner)".
- A quality attribute without a driver is removed.
- The reference of the professor is lab/lesson-9/tcg_dataapp/docs/
  business_drivers.md: use its form, not its content.

[T] Type of output
The file docs/business_drivers.md and the summary of the DataApp.

[E] Extras
Show the plan before writing. Record this prompt in docs/prompts.md.
Stop at the end.

Step 02 · 0:48 · Utility tree · alone

The utility tree, rated

The attributes are refined until each leaf names a situation that can happen to this DataApp. The two letters of each leaf decide the order of the rest of the session.

Produces

docs/utility_tree.md and docs/scenarios.toml with ten to fifteen leaves, each with id, attribute, refinement, importance and difficulty.

Done when
  • Is every leaf a situation, not a wish?
  • Is every H justified in one sentence?
  • Is the order of analysis written?
Prompt 02 · CREATE
[C] Character
You are the same architect. The business drivers and the quality
attributes are in docs/business_drivers.md.

[R] Request
1. Build the utility tree in docs/utility_tree.md: the root is Utility,
   the first level the quality attributes, the second their refinements,
   and each leaf one concrete scenario in one line, with an id (S01,
   S02, ...).
2. Rate each leaf with two letters, (importance, difficulty), each H, M
   or L: importance for the business drivers, difficulty for the
   architecture to achieve it. Justify each H in one sentence.
3. Give the order of analysis: (H,H) first, then (H,M), (M,H), and so on.
4. Create docs/scenarios.toml with one [[scenario]] per leaf, filling id,
   attribute, refinement, importance, difficulty and drivers; the six
   parts stay empty until step 03.

[E] Example
Utility
├── Correctness
│   ├── Idempotent runs ................ S01 (H,M)
│   └── Schema drift of the source ..... S04 (H,H)

[A] Adjustments
- Ten to fifteen leaves; at least one leaf per attribute of step 01.
- A leaf names a situation that can happen to this DataApp ("the source
  renames a field"), never a wish ("the system is robust").
- Use lab/lesson-9/tcg_dataapp/docs/scenarios.toml as the format of the
  file.

[T] Type of output
docs/utility_tree.md, docs/scenarios.toml and the order of analysis.

[E] Extras
Show the tree before writing the files. Record this prompt in
docs/prompts.md. Stop at the end.

Step 03 · 0:55 · Scenarios · alone

Each leaf in six parts

The leaves rated (H,H), (H,M) and (M,H) become scenarios first. The response measure is the part that matters most: it is what the test of step 05 will assert.

Produces

the six parts of each scenario in docs/scenarios.toml, and docs/scenarios.md with one table per scenario.

Done when
  • Is every measure a number or a verifiable condition?
  • Were the numbers taken from the real data measured first?
  • Which scenarios are still empty?
Prompt 03 · CREATE
[C] Character
You are the same architect. The utility tree and the order of analysis are
in docs/utility_tree.md and docs/scenarios.toml.

[R] Request
For every leaf rated (H,H), (H,M) or (M,H), and then for as many of the
others as time allows, write the quality attribute scenario in six parts
in docs/scenarios.toml:
- source: who or what generates the stimulus;
- stimulus: the event that reaches the system;
- artifact: the part of the DataApp that receives it (a file, a table,
  a task);
- environment: the state of the system when it happens;
- response: what the DataApp must do;
- measure: how the response is measured, with a number or a
  verifiable condition.
Then generate docs/scenarios.md, with one table of six rows per scenario.

[E] Example
source = "tcgcsv.com"
stimulus = "is down during the whole run"
artifact = "pipeline.py and cli.py"
environment = "unattended daily run after a successful run"
response = "the run fails naming the task, skips its dependents and leaves what was published"
measure = "exit code 1; no new row in db_ingestion; out/report.md byte-identical"

[A] Adjustments
- The measure must be checkable by a test: "fast" or "reliable" is not a
  measure; "less than 10 s on 100,000 rows" is.
- When a number of the measure comes from the real data (a share of
  nulls, a time), measure it on the real data first and write the value
  measured next to the limit.
- Keep the six parts short: one line each.

[T] Type of output
docs/scenarios.toml filled, docs/scenarios.md, and the list of the
scenarios that are still empty.

[E] Extras
Show the scenarios before writing. Record this prompt in docs/prompts.md.
Stop at the end.

Step 04 · 1:10 · Test cases · alone

From each scenario, its test cases

A test case turns the stimulus into data that a test can produce, the environment into a fixture and the measure into assertions. Each case traces to exactly one scenario.

Produces

docs/test_cases.md (case, scenario, what it checks, test function, level), the field cases of the TOML and the contracts in docs/contracts/.

Done when
  • Does every test case trace to one scenario?
  • Is the level of each case stated?
  • Does no case depend on the network?
Prompt 04 · CREATE
[C] Character
You are a test engineer who derives test cases from ATAM scenarios. The
scenarios are in docs/scenarios.toml.

[R] Request
1. For each scenario with six parts, derive one to three test cases
   (TC01.1, TC01.2, ...). A test case fixes the stimulus as data the test
   can produce, the environment as a fixture, and the measure as
   assertions. Add the list to the field cases of the scenario.
2. Write docs/test_cases.md: test case, scenario, what it checks, and the
   name of the test function that will implement it.
3. Say which level each test case is: unit (one function), integration
   (one layer with a real DuckDB) or end to end (the whole pipeline with
   a fake source).
4. When the measure is a contract (names and types of an output),
   write the contract as a file in docs/contracts/.

[E] Example
| TC04.1 | S04 | a renamed price field stops the run |
tests/scenarios/test_correctness.py::test_s04_renamed_price_field_stops_the_run |

[A] Adjustments
- Every test case traces to exactly one scenario; a test case without a
  scenario is not written.
- No test case calls the network: the source is a fake client, as in
  tests/conftest.py of the reference package.
- Do not write the tests yet.

[T] Type of output
docs/test_cases.md, the field cases of docs/scenarios.toml and the
contracts, if any.

[E] Extras
Show the table before writing. Record this prompt in docs/prompts.md.
Stop at the end.

Step 05 · 1:20 · Tests · alone

Implement the tests and run them on the code as it is

The suite is written in Arrange, Act, Assert, with the traceability plugin of the reference. It runs first on the code as it is: a failing test at this point is a finding about the architecture.

Produces

tests/scenarios/, the plugin and the fixture without network in conftest.py, the marker in pyproject.toml, out/junit.xml.

Done when
  • Does pytest end with the table "ATAM traceability"?
  • Was the first run kept, with its failures?
  • Does python tools/traceability.py print the tree?
Prompt 05 · CREATE
[C] Character
You are the same test engineer. The test cases are in docs/test_cases.md.

[R] Request
1. Copy into tests/conftest.py the traceability plugin of the reference
   package (lab/lesson-9/tcg_dataapp/tests/conftest.py, section
   "traceability"), the fixture that blocks the network, and adapt the
   fake source to the data of the DataApp.
2. Register the marker in pyproject.toml:
   markers = ["scenario(id): the ATAM scenario of docs/scenarios.toml
   that the test covers"] and addopts = "--strict-markers".
3. Implement each test case as one function in tests/scenarios/, marked
   with @pytest.mark.scenario("Sxx") and with the id of the test case as
   the first line of its docstring, following Arrange, Act, Assert.
4. Run pytest against the code AS IT IS, without fixing anything, and
   keep the output: the passed and failed tests and the table "ATAM
   traceability".
5. Run pytest --junitxml=out/junit.xml and
   python tools/traceability.py (copied from the reference).

[E] Example
@pytest.mark.scenario("S04")
def test_s04_renamed_price_field_stops_the_run(settings):
    """TC04.1 a renamed price field stops the run"""
    prices = rename(PRICES, "marketPrice", "market_price")            # Arrange
    ctx = pipeline.run(settings, client=FakeClient(prices=prices))   # Act
    assert "check_quality" in ctx.results["_failed"]                 # Assert

[A] Adjustments
- A failing test is a result, not a bug of the test: do not change the
  assertion to make it pass, and do not fix the DataApp in this step.
- Use fixtures for the environment and parametrize for variations of the
  same stimulus.
- The whole suite must run without the network.

[T] Type of output
The tests, the output of pytest with the traceability table, and the
utility tree printed by tools/traceability.py.

[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.

Step 06 · 1:45 · Findings · alone

Read the results back into the tree

Each failure and each pass says something about a decision of the architecture. The findings are classified, the risks of high importance are closed when time allows, and the suite runs again.

Produces

docs/results.md (both runs, the table of findings) and docs/traceability.md.

Done when
  • Does each finding cite its scenarios?
  • Are the risks left open marked as open, with the reason?
  • Does every number come from a run of this session?
Prompt 06 · CREATE
[C] Character
You are the architect again. The tests ran and the results are in
out/traceability.json and in the output of pytest.

[R] Request
1. Write docs/results.md with the first run: passed and failed tests,
   and, for each failed scenario, what the failure shows about the
   architecture.
2. Classify the findings in a table: risks (a decision that may prevent
   a response), non-risks (a decision that the tests showed to be sound),
   sensitivity points (a parameter or decision on which a response
   depends) and tradeoffs (a decision that improves one attribute and
   harms another). Each finding cites its scenarios.
3. For each risk of a scenario rated H in importance, propose the smallest
   change of the code that closes it; implement the ones that fit in the
   time of the session, run pytest again and record the second run.
4. Print the final utility tree with python tools/traceability.py and
   write docs/traceability.md with python tools/traceability.py --markdown.

[E] Example
| Sensitivity point | the timestamp of noon UTC decides what is the
same batch; another hour breaks S01 | S01 |

[A] Adjustments
- A risk that was not closed stays in the table as open, with the reason.
- Do not remove a scenario because its test failed.
- Every number of docs/results.md comes from a run of this session.

[T] Type of output
docs/results.md, docs/traceability.md, the final tree and the output of
the second run of pytest.

[E] Extras
Show the classification before writing. Record this prompt in
docs/prompts.md. Stop at the end.

Step 07 · 1:55 · Pipeline · alone

The tests on every push, in GitLab CI

A suite that runs only when someone remembers stops protecting the DataApp. On git.inteli.edu.br, a pipeline runs it on every push and every merge request, shows the failed tests in the merge request, and a daily schedule runs the DataApp on the real data.

Produces

.gitlab-ci.yml with the stages test, report and smoke; merge request !1 with its pipeline; the protection “Pipelines must succeed” and a schedule of main at 06:00 UTC.

Done when
  • Does the merge request show the test report of both test jobs?
  • Does a failing scenario turn the pipeline red and block the merge?
  • Does the job of the tree run also after a failure?
Prompt 07 · CREATE
[C] Character
You are the same test engineer. The suite passes on your machine; now it
must run on every push, without anyone remembering to run it, on the
GitLab of Inteli (git.inteli.edu.br).

[R] Request
1. .gitlab-ci.yml at the root of the repository, with the image
   python:3.12-slim, a pip cache keyed by pyproject.toml, and three stages:
   - test: two jobs that install the package and run pytest with
     --junitxml, one for the tests of the package (tests/test_*.py) and
     one for tests/scenarios; both publish the JUnit report with
     artifacts:reports:junit, even when a test fails (when: always), and
     the job of the scenarios keeps out/traceability.json;
   - report: a job traceability that needs test:scenarios, runs also
     after a failure (when: always) and publishes the table of
     tools/traceability.py --markdown as an artifact;
   - smoke: a job that runs only in a pipeline schedule:
     tcg-dataapp run --with-today, then the check of freshness of S11.
2. workflow:rules so that a commit pushed to a branch with an open merge
   request runs one pipeline (the merge request pipeline), not two.
3. Push the branch, open a merge request to main and show the pipeline,
   the test report of the merge request and the artifact of the tree.
4. In Settings > Merge requests, turn on "Pipelines must succeed", and
   in CI/CD > Schedules create a schedule of main at 0 6 * * * (UTC).

Facts measured on 12/11/2026 (confirm before use):
- the merge request pipeline of version 0.3.0: 9 tests in test:unit and
  20 in test:scenarios, all passed; the tree reports 14 of 14 PASS.
- a commit that disables the gate of S04 (MAX_NULL_SHARE = 1.0) fails
  test:scenarios with 1 test, TC04.1; traceability still runs and marks
  S04 FAIL 1/2; with "Pipelines must succeed" the merge is blocked.

[E] Example
test:scenarios:
  stage: test
  script:
    - pytest tests/scenarios --junitxml=out/junit-scenarios.xml
  artifacts:
    when: always
    reports:
      junit: out/junit-scenarios.xml

[A] Adjustments
- The pipeline has no secret and no network in the tests: the plugin of
  conftest.py already blocks it. Only the smoke job uses the network.
- A failed test is never retried in CI and never marked allow_failure:
  the red pipeline is the result that the merge request must show.
- Do not commit .venv/, out/ or warehouse/; .gitignore already lists them.

[T] Type of output
The file, the output of git push, and a description of what GitLab shows:
the pipeline graph, the test report and the widget of the merge request.

[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.
Self-study
Self-study for this session

Readings and videos assigned on Adalove, on pytest, and the reading material of the session, which covers the ATAM and the reference in full.

Material

Lesson 9 material

The method step by step, the fourteen scenarios of the reference, the prompts and the two runs, with the risks and tradeoffs found.

this repository
Next sessionLesson 10 turns the run log and the check of freshness into metrics with alerts, which closes the open risk of S11: today nothing calls tcg-dataapp freshness on schedule.

About this session

Automated Testing · 03/12/2026 · Prof. Afonso

Learning objective

By the end of the session, students should be able to derive the automated tests of a DataApp from its quality attributes with the ATAM, building the business drivers, a rated utility tree and quality attribute scenarios in six parts, implementing test cases traced to the scenarios as pytest tests in Arrange, Act, Assert, and reading the results back into the tree as risks, non-risks, sensitivity points and tradeoffs.

Session strategy

Short exposition followed by individual work graded in class. In 25 minutes the professor presents automated testing with pytest (levels of test, Arrange, Act, Assert, fixtures, parametrize and markers) and the ATAM, applied in full to the package of Lesson 7, whose first run failed 5 of 29 tests in three scenarios. Each student then applies the six steps alone to the DataApp of the group, with the CREATE prompts of the lab and a coding agent, while the professor circulates; this work is the graded DAG and Testing Activity on Adalove, delivered individually as a branch with a Prefect pipeline and the tests, documented in a pull request, by Friday.

Session structure

  1. Daily — 15 min
  2. Automated tests, levels of test and pytest — 10 min
  3. The ATAM: drivers, utility tree, six-part scenarios and findings; the reference — 15 min
  4. Steps 01–02 alone: drivers, attributes and utility tree — 15 min
  5. Step 03 alone: scenarios in six parts — 15 min
  6. Steps 04–05 alone: test cases, tests and first run — 35 min
  7. Step 06 alone: findings, second run and delivery — 15 min