From abd96b01d83bc5c19449036c4a65a302c3b638aa Mon Sep 17 00:00:00 2001 From: Mathias Moser Date: Fri, 4 Dec 2026 10:31:29 +0100 Subject: [PATCH 1/2] fix(e2e-testing): what a team meets in the workshop, end to end Walked step 2 as team 09 (PURIS) with its printed handout: Bruno against the mock, the team's own draft in the Test Suite IDE, and a TCK run with TestLab on a laptop. Fixes what got in the way. - Mocks: "Reset every scenario" resets only the product's own scenarios. All products share one WireMock in the workshop, and the global /__admin/scenarios/reset also reset the other teams' runs. build_mappings.py fails on a scenario name two products share, or a reset list that differs from the mappings; CI runs it and checks the cluster set. - PURIS mock: reported stocks answer [] before PURIS has fetched (was 404), and a second refresh answers 200. Bruno environments use mock.json's keys. - Template: the validate/field hint used items[0].id, which silently yields None. TestLab indexes lists as a segment, items.0.id. syntax.md explains it, and that a quantity like 20.0 is compared with a number. - Specs: a test can say needsRealProduct. Its page and "Done when" then say it compiles against the mock and turns green in step 3. PURIS uses it for the four tests a mock cannot make green; its negative registry test first finds the known material, so an empty registry no longer passes it. - Handouts: box D prints the data plane's public API (dataplanePublicUrl), which engine_dataplane_public_url asks for. - Chapters 3 and 6: the two-factor offer and welcome window, engine_* values from box D (engine_bpnl via "Another BPNL"), the SUT Setup that asks for nothing, the step that waits for the product and times out, and "got None". Assisted-By: Claude Opus 5.5 Signed-off-by: Mathias Moser --- .github/workflows/e2e-testing-site.yml | 5 +++ e2e-testing/admin/handouts/build_handouts.py | 1 + .../admin/handouts/inventory.sample.json | 5 +++ .../admin/handouts/inventory.schema.json | 5 +++ .../tests/partner_uses_my_product.yaml | 2 +- .../docs/downloads/e2e-test-template.zip | Bin 4618 -> 4615 bytes e2e-testing/docs/reference/syntax.md | 9 +++++ e2e-testing/docs/specs/puris.md | 22 +++++++--- e2e-testing/docs/specs/puris.yaml | 23 +++++++++-- e2e-testing/docs/tutorial/03-your-product.md | 3 +- e2e-testing/docs/tutorial/06-run-it.md | 15 +++++-- e2e-testing/mocks/README.md | 5 ++- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- e2e-testing/mocks/deploy/build_mappings.py | 38 ++++++++++++++++++ e2e-testing/mocks/deploy/kustomization.yaml | 1 + .../puris__partner_stock_not_yet.json | 8 ++-- .../deploy/mappings/puris__refresh_again.json | 14 +++++++ .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../bruno/environments/mock.bru | 2 +- .../bruno/environments/workshop.bru | 2 +- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../mocks/puris/bruno/environments/mock.bru | 2 +- .../puris/bruno/environments/workshop.bru | 2 +- .../mappings/partner_stock_not_yet.json | 8 ++-- .../wiremock/mappings/refresh_again.json | 14 +++++++ .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- .../01 Reset every scenario.bru | 30 +++++++++++--- e2e-testing/specs/build_specs.py | 13 +++++- e2e-testing/specs/puris.yaml | 23 +++++++++-- e2e-testing/specs/spec.schema.json | 4 ++ .../e2e/tests/partner_uses_my_product.yaml | 2 +- 43 files changed, 619 insertions(+), 119 deletions(-) create mode 100644 e2e-testing/mocks/deploy/mappings/puris__refresh_again.json create mode 100644 e2e-testing/mocks/puris/wiremock/mappings/refresh_again.json diff --git a/.github/workflows/e2e-testing-site.yml b/.github/workflows/e2e-testing-site.yml index 838385c94..17015cbb7 100644 --- a/.github/workflows/e2e-testing-site.yml +++ b/.github/workflows/e2e-testing-site.yml @@ -79,6 +79,11 @@ jobs: - name: The agent kit carries the current template and example run: python tools/build_agent_kit.py --check + - name: The mocks' cluster set is current, and each product resets only its own scenarios + run: | + python mocks/deploy/build_mappings.py + git diff --exit-code -- mocks/deploy + - name: The sample handouts build run: python admin/handouts/build_handouts.py --inventory admin/handouts/inventory.sample.json --no-pdf --out "${RUNNER_TEMP}/handouts" diff --git a/e2e-testing/admin/handouts/build_handouts.py b/e2e-testing/admin/handouts/build_handouts.py index 06999845f..c6b513e4c 100644 --- a/e2e-testing/admin/handouts/build_handouts.py +++ b/e2e-testing/admin/handouts/build_handouts.py @@ -80,6 +80,7 @@ ("Management API", "managementUrl"), ("API key", "apiKey"), ("DSP address", "dspUrl"), + ("Data plane, public API", "dataplanePublicUrl"), ("Participant ID", "participantId"), ("BPN", "bpn"), ("Digital Twin Registry", "dtrUrl"), diff --git a/e2e-testing/admin/handouts/inventory.sample.json b/e2e-testing/admin/handouts/inventory.sample.json index e2235b2d5..aa9ceeffb 100644 --- a/e2e-testing/admin/handouts/inventory.sample.json +++ b/e2e-testing/admin/handouts/inventory.sample.json @@ -29,6 +29,7 @@ "managementUrl": "https://consumer-management.team-01.example.org/management", "apiKey": "sample-key-consumer-01", "dspUrl": "https://consumer-dsp.team-01.example.org/api/v1/dsp/2025-1", + "dataplanePublicUrl": "https://consumer-dataplane.team-01.example.org/api/public", "participantId": "did:web:consumer.team-01.example.org:identityhub:BPNL000000000201", "bpn": "BPNL000000000201" } @@ -52,6 +53,7 @@ "managementUrl": "https://consumer-management.team-02.example.org/management", "apiKey": "sample-key-consumer-02", "dspUrl": "https://consumer-dsp.team-02.example.org/api/v1/dsp/2025-1", + "dataplanePublicUrl": "https://consumer-dataplane.team-02.example.org/api/public", "participantId": "did:web:consumer.team-02.example.org:identityhub:BPNL000000000202", "bpn": "BPNL000000000202" } @@ -75,6 +77,7 @@ "managementUrl": "https://consumer-management.team-03.example.org/management", "apiKey": "sample-key-consumer-03", "dspUrl": "https://consumer-dsp.team-03.example.org/api/v1/dsp/2025-1", + "dataplanePublicUrl": "https://consumer-dataplane.team-03.example.org/api/public", "participantId": "did:web:consumer.team-03.example.org:identityhub:BPNL000000000203", "bpn": "BPNL000000000203" } @@ -98,6 +101,7 @@ "managementUrl": "https://consumer-management.team-04.example.org/management", "apiKey": "sample-key-consumer-04", "dspUrl": "https://consumer-dsp.team-04.example.org/api/v1/dsp/2025-1", + "dataplanePublicUrl": "https://consumer-dataplane.team-04.example.org/api/public", "participantId": "did:web:consumer.team-04.example.org:identityhub:BPNL000000000204", "bpn": "BPNL000000000204" } @@ -121,6 +125,7 @@ "managementUrl": "https://consumer-management.team-05.example.org/management", "apiKey": "sample-key-consumer-05", "dspUrl": "https://consumer-dsp.team-05.example.org/api/v1/dsp/2025-1", + "dataplanePublicUrl": "https://consumer-dataplane.team-05.example.org/api/public", "participantId": "did:web:consumer.team-05.example.org:identityhub:BPNL000000000205", "bpn": "BPNL000000000205" } diff --git a/e2e-testing/admin/handouts/inventory.schema.json b/e2e-testing/admin/handouts/inventory.schema.json index 6ae331e70..01352aae6 100644 --- a/e2e-testing/admin/handouts/inventory.schema.json +++ b/e2e-testing/admin/handouts/inventory.schema.json @@ -127,6 +127,11 @@ "type": "string", "format": "uri" }, + "dataplanePublicUrl": { + "description": "Public API of the connector's data plane, ending in /api/public. A TCK whose product calls TestLab through its own connector asks for the partner side's as engine_dataplane_public_url.", + "type": "string", + "format": "uri" + }, "participantId": { "description": "The connector's participant id, a DID for current connectors.", "type": "string" diff --git a/e2e-testing/agent-kit/skills/tractusx-e2e-test/assets/template/tests/partner_uses_my_product.yaml b/e2e-testing/agent-kit/skills/tractusx-e2e-test/assets/template/tests/partner_uses_my_product.yaml index f7b66348b..7f743bb6a 100644 --- a/e2e-testing/agent-kit/skills/tractusx-e2e-test/assets/template/tests/partner_uses_my_product.yaml +++ b/e2e-testing/agent-kit/skills/tractusx-e2e-test/assets/template/tests/partner_uses_my_product.yaml @@ -110,7 +110,7 @@ execution: # TODO: check what your product promises, not only that it answers. # For example a field of the answer: # - uses: validate/field - # with: { input: body, path: "items[0].id", operator: not_null } + # with: { input: body, path: "items.0.id", operator: not_null } teardown: - id: delete_contract diff --git a/e2e-testing/docs/downloads/e2e-test-template.zip b/e2e-testing/docs/downloads/e2e-test-template.zip index 57630723b60985f09b00a11b864c8ffd45606176..95f90368983d63a7cd8a8a98a2f46b584aab9338 100644 GIT binary patch delta 1529 zcmV{C-Y1*d+y&Oq|SKKYhl`I7L_a1UDT3NEA1P%h&=FXhCof!_#&ffT6 z=Zr41d~4KV>FB5A9bKGX{DLFxjCv?sW-Pgk+>+@!NmXu{Zn8p4;Z&wOUVFwIK2N6i z^})|PwpH;j6hE~0bVELE~3*ni#O2nT?rbGaQ32Aj<$587GeHZD1+QQY)RxfQ+G6@@vKX~k7napk3Nm>|D1lj2iB+2-Q8$%Kfa#P^o}m4 zlYgu6{dhXTUpF+G{7Zk0Cs#dU)DUL)DL3AKIH^`}n`Klp08q69zQW!in{%S(DnVR& zQHTZ8B3rZ3zD7AxudGk74Mj}VO1Z!R3#5af%IwWhx+l3}Glq zbCa!5P{~ixR;<#F0%k6Z1G)PJ$kN}bcRDL}0$nDC9U^aGhyvEqP0w8CcXXvMG0QQ+0?qCKmvR0thpweiGmRY_G z=k-YORBws+K{gD(QFV-b|M2-Uv437id&cR@mu?U=aMWnKuNA}R>Hx8CbJ+Fmsu!K- z5fv6)^Hu=`u#@9yn|`Zsghk;_ieo2PhB5VI+T)359wu8O*A6C}wqmJtO4OHv2_H|7 zrKa*p;nc#hWHd;)`dY!=77wYi%U#!0^Y0w~g;#OfOgakFWd4{F{##T_yi~gva`8eX`H7PvjK!v?&6GM? zPW)zz70Q_xX&U=U6l2lB_Q0}L#v4^FBV`T!h-+Y5v+qbD3k|H;kI`+6)yQA5RW7g_ z83Dgh&BAbG3m5H%vb1?zn16JyAZ@57qpzZPSuhOCliM##8KT`~u}>MUZNwF)Joo+8 ztUo_185SRw$p9A+uAqUo10}nSE|t142)$nq&Vd=0y>FlZ`E3Ltu#D>-`Nr|}m5wiu ze6_>1<5T^rBuf*!?2+{=QfrYaAaX6zuees954=ytH2{Gp$_3-)O82lW)H-5Rc6h!s5n}{0d7h&d(bX)c#?EP9E{p5pK^l{}Zb^Lm8#Ub0XcM z2oO?!jk6n!h^Rrj$^0Wh;BDYX9+vY|*6*uQcG!p>i7d#s1P+3G$mF(Hr&c*$S^&)-p_=O-`=0#qBMB9HKYIJtNO54Yd*>7xJqE$^H@&UstzPe z*Y9|ht*dSKIP000J)Y7t=p9+S)wI0hCG00000uIury delta 1532 zcmVz7tESjKXimQs%O?MPaD+Pm)VNfsghz0dBw=w!)`5*z}y_hz1XduDd_B{<*2*m)qb#j6^FXuAkdRV&2$2FpX&fyBBpIFyBbA<0(zuna zH5-5V1IXuBOCx0&gFJA7_8UpNCf>TGxI@O zV%Wh4d)CWX?a`<4-S3l+cfk5|c6)nveK)?G(&U!T zCx6!$5U+4bM_$N2i9M~oW63_s?^`wu785^l4MY6bwRcEDHIJ7jZC)J!Fa zOV0~2XPRd#Hrm%HN9vXJ3AUk#sah%*IADRa7gU+O>CMGo{pzGYmaHA%*^H{%`80Q4 zyF*Sood>1m2xPIYV>jA~#}TdG^+lR5M1QBF#gZ+|^N5z4K6ojM#P#`<2~?e2OhzFL zC23}|B?>C}G1`b_+EKvFg>fKvzW`bKTlG$7$xfil#Hd5$EsRjWTAI8xj8P@sh0LlX zE5ugA=v_4QXOeAVRPMt0FE}8&$t>8k;t-54ohx$if5yJg;bw*Cd8eF34{FT`rhh<$ zt}B(im=0JXfrP;S+OH9GFaWeHu>x$5G|w}q(2-s;@q-15q2!53QyZY#rrpA1#e5OY z8v8$j(#QtoU=p~{vEFf?n?Ct8CWc`k#t;BG<2*w@Z33{*)MyJcfRU8~wFZ?&OSH`L zc{r~}il=%@#1FDj_>HP#rDtukJzY8feO=to=w+nRj`3R!4i#eR%#Vys5~imh^i z-N*>|jcOK#BU`v=JCvo(m!XWg1-a7|oSoXew0_3+5gupVcd*mC(*H=2e zJo42J*N#v1i;^r&?6L>eFG#IKs({F~NWbD*eLnC$8P@;=o{+C#UVk7twa2|yHnB=# z)$MtRf{)7|efd7~O@wXxI&-l`UjTGFBXPCI^)hp)qnfM^JcnYx5Bv3M+f3&``1)S3 z*Gs$As_0O+d(^aJv?JH1R8zy}bsL$M9`?0GhQNQjysPg<;ZxTgbela8*HxJ{|Ej>F zW0Mu84i5{?+0FPhD1TzHMHdz~j^r0uaylF~B&hwv2Aw?MsUzHuYyKxzb%ruZjpszV zK@lLN{2FK17!gr}bd~u>g23Crk31~rsjS~urR=B?JrG%tZwc%Lcb~~kuTHIUytMxe z|BWzbo+G4VJSXvh+)jGQDIa}(KM_8BeSdJYA>OuWxttF$wDuHrOV>x22 z+LJ6@zvX4Ns@C1-H>u;V=BJ(=zrR)rd;4q4!z1?BZ{I-na(Vn4;s}?Ic|&~1_Vqur i9t}VQ39+hkvbF^P00)z25n%x#lgSY{1{o0m0000XZuuSn diff --git a/e2e-testing/docs/reference/syntax.md b/e2e-testing/docs/reference/syntax.md index 9ec43297f..307ac2d0a 100644 --- a/e2e-testing/docs/reference/syntax.md +++ b/e2e-testing/docs/reference/syntax.md @@ -167,6 +167,15 @@ product refuses a caller that did not sign in. Common operators: `equals`, `contains`, `not_empty`, `gt`, `lt`, `matches_regex`. +**A `path` into a list takes the index as a segment of its own:** `items.0.id`, and `0.quantity` +when the answer itself is a list. Brackets pick an element by a field instead: +`endpoints[interface='SUBMODEL-3.0']`. A path that leads nowhere is not an error: it yields +`None`, and the check fails with `Expected …, got None`. Seeing `got None` for a field you can see in +the answer means the path is wrong, not the product. + +**Compare numbers with numbers.** A quantity the product answers as `20.0` does not equal the +string `"20"`. Give such a value a `variable/type/number`, or write it without quotes. + ## Commands ```bash diff --git a/e2e-testing/docs/specs/puris.md b/e2e-testing/docs/specs/puris.md index 11f43e903..4fa76b3e9 100644 --- a/e2e-testing/docs/specs/puris.md +++ b/e2e-testing/docs/specs/puris.md @@ -7,7 +7,7 @@ Repository: [`puris`](https://github.com/eclipse-tractusx/puris) · Spec 1.0 · **Draft** · [Raw spec for your AI](puris.yaml) · [All specs](index.md) > [!NOTE] -> Not run yet. Two PURIS instances, each with a connector and a Digital Twin Registry, are not in the workshop environment. Build and compile it in the workshop; run it where the product is deployed. Check each path against the OpenAPI of the release you test. +> Against the workshop mock only puris_backend_needs_key can be green: the other tests need PURIS itself to act through its connector. Build and compile them in the workshop; they turn green with the real product in step 3. Check paths against the release's OpenAPI. ## 1 · The product in brief @@ -105,6 +105,8 @@ Every row is one step. Every ☐ is one `validate` entry. The step names are Tes **Proves:** PURIS publishes its data through the connector, where partners can find it. +**Against the mock (box M):** build and compile it, it cannot be green there. PURIS creates these offers in its own connector. The mock has no connector, so the catalog of connector C holds no PURIS offer. It turns green with the real product in step 3. + **execution** | # | What happens | Step | Must be true | @@ -117,6 +119,8 @@ Every row is one step. Every ☐ is one `validate` entry. The step names are Tes **Proves:** The short-term data actually reaches the partner, for the right material. +**Against the mock (box M):** build and compile it, it cannot be green there. PURIS registers the material twin in its own registry. The workshop registry holds none. It turns green with the real product in step 3. + **execution** | # | What happens | Step | Must be true | @@ -144,6 +148,8 @@ Every row is one step. Every ☐ is one `validate` entry. The step names are Tes **Proves:** PURIS works as a customer too: it finds the partner's twin, pulls its ItemStock and shows the quantities the partner offered. +**Against the mock (box M):** build and compile it, it cannot be green there. At "Wait for PURIS's request" PURIS must find TestLab's offer, negotiate it and call it through its own connector. The mock cannot call out: the run waits two minutes and fails with a timeout. It turns green with the real product in step 3. + **setup** | # | What happens | Step | Must be true | @@ -172,12 +178,15 @@ Every row is one step. Every ☐ is one `validate` entry. The step names are Tes **Proves:** PURIS does not publish twins for materials it does not know. +**Against the mock (box M):** build and compile it, it cannot be green there. It first finds the twin of the known material, which only the real PURIS registers. It turns green with the real product in step 3. + **execution** | # | What happens | Step | Must be true | | --- | --- | --- | --- | | 1 | Negotiate access to the supplier's registry. | `connector/discover/digital-twin-registry/auth` | – | -| 2 | Look up a material number that is new in every run. | `digital-twin-registry/consumer/dataplane/lookup_shell` | ☐ The list of shell ids is empty. | +| 2 | Look up material_number, the material both sides know. | `digital-twin-registry/consumer/dataplane/lookup_shell` | ☐ One twin is found, so the empty answer below is a refusal and not an empty registry. | +| 3 | Look up a material number that is new in every run. | `digital-twin-registry/consumer/dataplane/lookup_shell` | ☐ The list of shell ids is empty. | ## 5 · Break it on purpose @@ -191,6 +200,7 @@ A check that cannot fail proves nothing. Make each change once, see the test go - Both sides need the same material in their master data, and a partner relationship to each other, before the run. - The PURIS usage policy names the framework agreement Puris: check the version the release uses. +- A quantity comes back as a number (20.0). Compare it with a number, not with the string "20": give the expected quantity a variable/type/number. ## 7 · Not in this spec @@ -215,11 +225,11 @@ Compile after each file and fix what the compiler reports. The [definition of done](index.md#done-when) for every product, and: -- [ ] `tests/offers_in_catalog.yaml` is green. -- [ ] `tests/customer_reads_item_stock.yaml` is green. +- [ ] `tests/offers_in_catalog.yaml` compiles; it is green with the real product (step 3). +- [ ] `tests/customer_reads_item_stock.yaml` compiles; it is green with the real product (step 3). - [ ] `tests/puris_backend_needs_key.yaml` is green. -- [ ] `tests/puris_pulls_partner_stock.yaml` is green. -- [ ] `tests/unknown_material_has_no_stock.yaml` is green. +- [ ] `tests/puris_pulls_partner_stock.yaml` compiles; it is green with the real product (step 3). +- [ ] `tests/unknown_material_has_no_stock.yaml` compiles; it is green with the real product (step 3). ## Sources diff --git a/e2e-testing/docs/specs/puris.yaml b/e2e-testing/docs/specs/puris.yaml index 592a176f0..5fe1418cc 100644 --- a/e2e-testing/docs/specs/puris.yaml +++ b/e2e-testing/docs/specs/puris.yaml @@ -9,9 +9,9 @@ product: puris specVersion: '1.0' status: draft statusNote: >- - Not run yet. Two PURIS instances, each with a connector and a Digital Twin Registry, are not - in the workshop environment. Build and compile it in the workshop; run it where the product - is deployed. Check each path against the OpenAPI of the release you test. + Against the workshop mock only puris_backend_needs_key can be green: the other tests need PURIS + itself to act through its connector. Build and compile them in the workshop; they turn green with + the real product in step 3. Check paths against the release's OpenAPI. inOneSentence: >- A supplier's PURIS offers its stock and forecasts through its connector, and the customer's PURIS finds those offers and reads the item stock for a shared material. @@ -91,6 +91,9 @@ tests: - contract proves: PURIS publishes its data through the connector, where partners can find it. side: provider + needsRealProduct: >- + PURIS creates these offers in its own connector. The mock has no connector, so the catalog of + connector C holds no PURIS offer. execution: - do: Query the supplier's catalog from the customer's connector. step: connector/consumer/query_catalog @@ -106,6 +109,8 @@ tests: - contract proves: The short-term data actually reaches the partner, for the right material. side: provider + needsRealProduct: >- + PURIS registers the material twin in its own registry. The workshop registry holds none. execution: - do: Negotiate access to the supplier's registry. step: connector/discover/digital-twin-registry/auth @@ -144,6 +149,9 @@ tests: - positive proves: "PURIS works as a customer too: it finds the partner's twin, pulls its ItemStock and shows the quantities the partner offered." side: consumer + needsRealProduct: >- + At "Wait for PURIS's request" PURIS must find TestLab's offer, negotiate it and call it through + its own connector. The mock cannot call out: the run waits two minutes and fails with a timeout. setup: - do: Register a mock registry with a material twin for material_number and an ItemStock submodel. step: mock/dtr @@ -175,9 +183,15 @@ tests: - negative proves: PURIS does not publish twins for materials it does not know. side: provider + needsRealProduct: >- + It first finds the twin of the known material, which only the real PURIS registers. execution: - do: Negotiate access to the supplier's registry. step: connector/discover/digital-twin-registry/auth + - do: Look up material_number, the material both sides know. + step: digital-twin-registry/consumer/dataplane/lookup_shell + check: + - One twin is found, so the empty answer below is a refusal and not an empty registry. - do: Look up a material number that is new in every run. step: digital-twin-registry/consumer/dataplane/lookup_shell check: @@ -195,6 +209,9 @@ pitfalls: before the run. - >- The PURIS usage policy names the framework agreement Puris: check the version the release uses. +- >- + A quantity comes back as a number (20.0). Compare it with a number, not with the string "20": + give the expected quantity a variable/type/number. sources: - label: PURIS repository url: https://github.com/eclipse-tractusx/puris diff --git a/e2e-testing/docs/tutorial/03-your-product.md b/e2e-testing/docs/tutorial/03-your-product.md index af4b12732..f2e515197 100644 --- a/e2e-testing/docs/tutorial/03-your-product.md +++ b/e2e-testing/docs/tutorial/03-your-product.md @@ -25,7 +25,8 @@ Raise your hand if a box is empty. Do not go on without it. > **At the Tractus-X Community Days 2026, ARENA2036.** The IDE is the workshop's Test Suite, > . Sign in with the account in box **B**: the > first sign-in asks you to accept the privacy policy. One account per team; every -> teammate may sign in with it. +> teammate may sign in with it. It may offer two-factor authentication: press **Not now**, +> since the whole team shares the account. Close the welcome window that follows. ## Steps diff --git a/e2e-testing/docs/tutorial/06-run-it.md b/e2e-testing/docs/tutorial/06-run-it.md index 8c96f7f0c..1399a83fd 100644 --- a/e2e-testing/docs/tutorial/06-run-it.md +++ b/e2e-testing/docs/tutorial/06-run-it.md @@ -17,11 +17,12 @@ both sides and the registry, is real. Before **every** run, reset the mock in Br | --- | --- | | **Build** | Nothing. It ends with "Compiled — ready to run." Press **Next**. | | **Infrastructure** | Choose your product under **App under test** and your connector under **EDC Connector**. If your test uses a registry, choose it under **Digital Twin Registry**. Press **Next**. | - | **Variables** | Click each value in the list. Fill in what is empty from box **C** of your handout: `product_internal_url` is "Product, as the connector reaches it", `dtr_internal_url` is "Registry, as the connector reaches it". With a box **M**, every address of your product itself (for example `puris_url`) is the **Address** in box **M**. A value named like a secret (`client_secret`, `…_token`, `…_password`) is shown as `***` once you paste it: that is right. Where the dialog offers a list, choose from it. Press **Next**. | - | **SUT Setup** | Press **Start review**, then **Accept all** and **Confirm all**. Your test creates these offers itself, in its setup. Press **Next**. | + | **Variables** | Click each value in the list. Fill in what is empty from box **C** of your handout: `product_internal_url` is "Product, as the connector reaches it", `dtr_internal_url` is "Registry, as the connector reaches it". With a box **M**, every address of your product itself (for example `puris_url`) is the **Address** in box **M**. Values named `engine_…` are the partner side, box **D**: `engine_bpnl` is its BPN (the list offers only your own connectors, so choose **Another BPNL** and type it), `engine_dataplane_public_url` is its "Data plane, public API". A value named like a secret (`client_secret`, `…_token`, `…_password`) is shown as `***` once you paste it: that is right. Where the dialog offers a list, choose from it. Press **Next**. | + | **SUT Setup** | Press **Start review**, then **Accept all** and **Confirm all**. Your test creates these offers itself, in its setup. Does it say "This TCK asks for nothing on your side"? Then there is nothing to accept. Press **Next**. | | **Summary & Launch** | Check the list of tests. Press **Run** at the bottom right. | - You type nothing from box **D**. The partner side is set up by the administrators. + The partner side, box **D**, is set up by the administrators. From it you only copy the + `engine_…` values the **Variables** step asks for. 2. Watch the **Console** at the bottom. Each step turns green or red as it finishes. 3. Wait for the result. @@ -79,6 +80,14 @@ The second step, **Infrastructure**, looks like this when your components are re > - **The mock answers 404 to a call your test makes:** in Bruno, run > **0 Mock control / Calls nothing answered**. It lists the calls the mock did not > recognise, usually a path or a method that differs from the spec. +> - **A step says "Waiting for your feedback" and fails after two minutes with +> `Timed out … waiting for GET …`:** here your product has to call TestLab on its own, through +> its connector. A mock cannot. Your spec marks such a test with **Against the mock (box M): +> … cannot be green**: build and compile it today; it turns green with the real product in +> step 3. +> - **A check says `Expected …, got None` for a field you can see in the answer:** the `path` +> is wrong, not the product. A list takes its index as a segment, `items.0.id`; see +> [Checks](../reference/syntax.md#checks). > - **A step is red:** open it and read the request and the answer. Decide which it is: > - **The environment.** Nothing answered, or a value is wrong. Fix the value or ask. > - **A finding.** The product answered, and not as your check expects. Either your diff --git a/e2e-testing/mocks/README.md b/e2e-testing/mocks/README.md index 78737dd79..c9c5474bf 100644 --- a/e2e-testing/mocks/README.md +++ b/e2e-testing/mocks/README.md @@ -18,7 +18,10 @@ docker run --rm -p 8089:8080 -v "$PWD/industry-core-hub/wiremock:/home/wiremock" ``` Then open `industry-core-hub/bruno` in Bruno, pick the environment `mock`, and run -**0 Mock control / Reset every scenario**. +**0 Mock control / Reset every scenario**. It puts only this product's scenarios back to +`Started`: in the workshop every product shares one WireMock, and a global reset would also reset +the other teams' runs. Its script lists the product's scenario names; `deploy/build_mappings.py` +fails when that list and the mappings disagree, or when two products use the same scenario name. ## Deploy them for the workshop diff --git a/e2e-testing/mocks/bpdm/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/bpdm/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..e1dcb7d76 100644 --- a/e2e-testing/mocks/bpdm/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/bpdm/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["bp"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["bp"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/data-exchange-test-service/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/data-exchange-test-service/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..48c6e84a7 100644 --- a/e2e-testing/mocks/data-exchange-test-service/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/data-exchange-test-service/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = []; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of []) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + This mock keeps no state, so there is nothing to reset: every call answers the same. Run it anyway before every test; it touches no other team's mock. } diff --git a/e2e-testing/mocks/dataspace-mgm/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/dataspace-mgm/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..48c6e84a7 100644 --- a/e2e-testing/mocks/dataspace-mgm/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/dataspace-mgm/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = []; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of []) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + This mock keeps no state, so there is nothing to reset: every call answers the same. Run it anyway before every test; it touches no other team's mock. } diff --git a/e2e-testing/mocks/deploy/build_mappings.py b/e2e-testing/mocks/deploy/build_mappings.py index 6c990aac2..65f7b9e56 100644 --- a/e2e-testing/mocks/deploy/build_mappings.py +++ b/e2e-testing/mocks/deploy/build_mappings.py @@ -7,11 +7,49 @@ WireMock serves them all. Writes mappings/__.json and the list of files into kustomization.yaml, between the two marker lines. """ +import json import pathlib +import re +import sys HERE = pathlib.Path(__file__).resolve().parent OUT = HERE / "mappings" START, END = " # mappings: start", " # mappings: end" +RESET = pathlib.Path("bruno", "0 Mock control", "01 Reset every scenario.bru") +OWN = re.compile(r"const own = (\[.*?\]);") + + +def check_scenarios() -> None: + """One WireMock serves every team, so a scenario belongs to one product only, + and each product's reset request names exactly its own scenarios.""" + owners: dict[str, set[str]] = {} + per_product: dict[str, set[str]] = {} + for source in HERE.parent.glob("*/wiremock/mappings/*.json"): + product = source.parents[2].name + data = json.loads(source.read_text()) + for mapping in data.get("mappings", [data]): + if name := mapping.get("scenarioName"): + owners.setdefault(name, set()).add(product) + per_product.setdefault(product, set()).add(name) + problems = [f"scenario {name!r} is used by {sorted(p)}: give each product its own name" + for name, p in sorted(owners.items()) if len(p) > 1] + for product_dir in sorted(p for p in HERE.parent.iterdir() if (p / "wiremock").is_dir()): + expected = per_product.get(product_dir.name, set()) + reset = product_dir / RESET + if not reset.exists(): + if expected: + problems.append(f"{product_dir.name}: no '{RESET}' for its scenarios {sorted(expected)}") + continue + found = OWN.search(reset.read_text()) + named = set(json.loads(found.group(1))) if found else None + if named != expected: + problems.append(f"{product_dir.name}: '{RESET}' resets {sorted(named or [])}, " + f"its mappings use {sorted(expected)}") + if problems: + sys.exit("\n".join(problems)) + + +check_scenarios() OUT.mkdir(exist_ok=True) for old in OUT.glob("*.json"): diff --git a/e2e-testing/mocks/deploy/kustomization.yaml b/e2e-testing/mocks/deploy/kustomization.yaml index 8a93fd942..0d38e5108 100644 --- a/e2e-testing/mocks/deploy/kustomization.yaml +++ b/e2e-testing/mocks/deploy/kustomization.yaml @@ -217,6 +217,7 @@ configMapGenerator: - mappings/puris__partner_stock.json - mappings/puris__partner_stock_not_yet.json - mappings/puris__refresh.json + - mappings/puris__refresh_again.json - mappings/sd-factory__accept_legal_participant.json - mappings/sd-factory__accept_legal_participant_again.json - mappings/sd-factory__delivered_credential.json diff --git a/e2e-testing/mocks/deploy/mappings/puris__partner_stock_not_yet.json b/e2e-testing/mocks/deploy/mappings/puris__partner_stock_not_yet.json index b92b18077..072a1f293 100644 --- a/e2e-testing/mocks/deploy/mappings/puris__partner_stock_not_yet.json +++ b/e2e-testing/mocks/deploy/mappings/puris__partner_stock_not_yet.json @@ -1,6 +1,6 @@ { - "name": "partner stock not yet", - "priority": 5, + "name": "partner stock not yet: nothing fetched", + "priority": 6, "request": { "method": "GET", "urlPath": "/mock/puris/catena/stockView/reported-material-stocks" @@ -14,7 +14,5 @@ "transformers": [ "response-template" ] - }, - "scenarioName": "stock", - "requiredScenarioState": "Requested" + } } diff --git a/e2e-testing/mocks/deploy/mappings/puris__refresh_again.json b/e2e-testing/mocks/deploy/mappings/puris__refresh_again.json new file mode 100644 index 000000000..8b57bf16e --- /dev/null +++ b/e2e-testing/mocks/deploy/mappings/puris__refresh_again.json @@ -0,0 +1,14 @@ +{ + "name": "refresh again: answered, the state stays", + "priority": 6, + "request": { + "method": "GET", + "urlPath": "/mock/puris/catena/materials/refresh" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + } + } +} diff --git a/e2e-testing/mocks/industry-core-hub/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/industry-core-hub/bruno/0 Mock control/01 Reset every scenario.bru index ee129f1c1..67f101308 100644 --- a/e2e-testing/mocks/industry-core-hub/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/industry-core-hub/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: eq 200 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["catalog-part", "serialized-twin"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["catalog-part", "serialized-twin"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start: no catalog part, no serialized twin. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/item-relationship-service/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/item-relationship-service/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..723d3391e 100644 --- a/e2e-testing/mocks/item-relationship-service/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/item-relationship-service/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["job", "policy"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["job", "policy"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/knowledge-agents/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/knowledge-agents/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..48c6e84a7 100644 --- a/e2e-testing/mocks/knowledge-agents/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/knowledge-agents/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = []; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of []) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + This mock keeps no state, so there is nothing to reset: every call answers the same. Run it anyway before every test; it touches no other team's mock. } diff --git a/e2e-testing/mocks/knowledge-agents/bruno/environments/mock.bru b/e2e-testing/mocks/knowledge-agents/bruno/environments/mock.bru index fb02bf971..c4602a26a 100644 --- a/e2e-testing/mocks/knowledge-agents/bruno/environments/mock.bru +++ b/e2e-testing/mocks/knowledge-agents/bruno/environments/mock.bru @@ -2,5 +2,5 @@ vars { mockAdmin: http://localhost:8089/__admin baseUrl: http://localhost:8089/mock/knowledge-agents/api/agent partId: E2E-PART-1 - agentApiKey: workshop + agentApiKey: workshop-agent-key } diff --git a/e2e-testing/mocks/knowledge-agents/bruno/environments/workshop.bru b/e2e-testing/mocks/knowledge-agents/bruno/environments/workshop.bru index 63c46dfb4..1bd948b17 100644 --- a/e2e-testing/mocks/knowledge-agents/bruno/environments/workshop.bru +++ b/e2e-testing/mocks/knowledge-agents/bruno/environments/workshop.bru @@ -3,5 +3,5 @@ vars { mockAdmin: {{mocksHost}}/__admin baseUrl: {{mocksHost}}/mock/knowledge-agents/api/agent partId: E2E-PART-1 - agentApiKey: workshop + agentApiKey: workshop-agent-key } diff --git a/e2e-testing/mocks/managed-service-orchestrator/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/managed-service-orchestrator/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..4a3806c01 100644 --- a/e2e-testing/mocks/managed-service-orchestrator/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/managed-service-orchestrator/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["execution"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["execution"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/managed-simple-data-exchanger/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/managed-simple-data-exchanger/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..9334082b7 100644 --- a/e2e-testing/mocks/managed-simple-data-exchanger/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/managed-simple-data-exchanger/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["download", "upload"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["download", "upload"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/portal/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/portal/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..f415011a6 100644 --- a/e2e-testing/mocks/portal/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/portal/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["app", "sa"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["app", "sa"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/puris/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/puris/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..65a4b2edd 100644 --- a/e2e-testing/mocks/puris/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/puris/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["stock"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["stock"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/puris/bruno/environments/mock.bru b/e2e-testing/mocks/puris/bruno/environments/mock.bru index 9c76c12ee..36b19cd4e 100644 --- a/e2e-testing/mocks/puris/bruno/environments/mock.bru +++ b/e2e-testing/mocks/puris/bruno/environments/mock.bru @@ -2,5 +2,5 @@ vars { mockAdmin: http://localhost:8089/__admin baseUrl: http://localhost:8089/mock/puris/catena materialNumber: MNR-7307-AU340474.001 - purisApiKey: workshop + purisApiKey: workshop-puris-key } diff --git a/e2e-testing/mocks/puris/bruno/environments/workshop.bru b/e2e-testing/mocks/puris/bruno/environments/workshop.bru index 50be13b49..e91614fc0 100644 --- a/e2e-testing/mocks/puris/bruno/environments/workshop.bru +++ b/e2e-testing/mocks/puris/bruno/environments/workshop.bru @@ -3,5 +3,5 @@ vars { mockAdmin: {{mocksHost}}/__admin baseUrl: {{mocksHost}}/mock/puris/catena materialNumber: MNR-7307-AU340474.001 - purisApiKey: workshop + purisApiKey: workshop-puris-key } diff --git a/e2e-testing/mocks/puris/wiremock/mappings/partner_stock_not_yet.json b/e2e-testing/mocks/puris/wiremock/mappings/partner_stock_not_yet.json index b92b18077..072a1f293 100644 --- a/e2e-testing/mocks/puris/wiremock/mappings/partner_stock_not_yet.json +++ b/e2e-testing/mocks/puris/wiremock/mappings/partner_stock_not_yet.json @@ -1,6 +1,6 @@ { - "name": "partner stock not yet", - "priority": 5, + "name": "partner stock not yet: nothing fetched", + "priority": 6, "request": { "method": "GET", "urlPath": "/mock/puris/catena/stockView/reported-material-stocks" @@ -14,7 +14,5 @@ "transformers": [ "response-template" ] - }, - "scenarioName": "stock", - "requiredScenarioState": "Requested" + } } diff --git a/e2e-testing/mocks/puris/wiremock/mappings/refresh_again.json b/e2e-testing/mocks/puris/wiremock/mappings/refresh_again.json new file mode 100644 index 000000000..8b57bf16e --- /dev/null +++ b/e2e-testing/mocks/puris/wiremock/mappings/refresh_again.json @@ -0,0 +1,14 @@ +{ + "name": "refresh again: answered, the state stays", + "priority": 6, + "request": { + "method": "GET", + "urlPath": "/mock/puris/catena/materials/refresh" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + } + } +} diff --git a/e2e-testing/mocks/sd-factory/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/sd-factory/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..e8f56dd17 100644 --- a/e2e-testing/mocks/sd-factory/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/sd-factory/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["delivery"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["delivery"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/sldt-bpn-discovery/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/sldt-bpn-discovery/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..52617bd0e 100644 --- a/e2e-testing/mocks/sldt-bpn-discovery/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/sldt-bpn-discovery/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["entry"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["entry"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/sldt-discovery-finder/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/sldt-discovery-finder/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..72f92e96d 100644 --- a/e2e-testing/mocks/sldt-discovery-finder/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/sldt-discovery-finder/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["endpoint"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["endpoint"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/sldt-semantic-hub/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/sldt-semantic-hub/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..48c6e84a7 100644 --- a/e2e-testing/mocks/sldt-semantic-hub/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/sldt-semantic-hub/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = []; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of []) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + This mock keeps no state, so there is nothing to reset: every call answers the same. Run it anyway before every test; it touches no other team's mock. } diff --git a/e2e-testing/mocks/ssi-credential-issuer/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/ssi-credential-issuer/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..808fadda5 100644 --- a/e2e-testing/mocks/ssi-credential-issuer/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/ssi-credential-issuer/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["credential"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["credential"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/mocks/ssi-dim-wallet-stub/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/ssi-dim-wallet-stub/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..48c6e84a7 100644 --- a/e2e-testing/mocks/ssi-dim-wallet-stub/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/ssi-dim-wallet-stub/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = []; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of []) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + This mock keeps no state, so there is nothing to reset: every call answers the same. Run it anyway before every test; it touches no other team's mock. } diff --git a/e2e-testing/mocks/traceability-foss/bruno/0 Mock control/01 Reset every scenario.bru b/e2e-testing/mocks/traceability-foss/bruno/0 Mock control/01 Reset every scenario.bru index 3628d23f3..e9ac63215 100644 --- a/e2e-testing/mocks/traceability-foss/bruno/0 Mock control/01 Reset every scenario.bru +++ b/e2e-testing/mocks/traceability-foss/bruno/0 Mock control/01 Reset every scenario.bru @@ -4,16 +4,36 @@ meta { seq: 1 } -post { - url: {{mockAdmin}}/scenarios/reset +get { + url: {{mockAdmin}}/scenarios body: none auth: none } -assert { - res.status: lt 300 +script:post-response { + // Only this product's scenarios: every product's mock shares one WireMock in the + // workshop, and a global reset would also reset the other teams' runs. + const own = ["received", "sent"]; + const admin = req.getUrl().replace(/\/scenarios$/, ""); + for (const name of own) { + const answer = await bru.sendRequest({ + method: "PUT", + url: `${admin}/scenarios/${name}/state`, + headers: { "Content-Type": "application/json" }, + data: { state: "Started" }, + }); + bru.setVar(`reset_${name}`, answer.status); + } +} + +tests { + test("every scenario of this product is back at Started", function () { + for (const name of ["received", "sent"]) { + expect(bru.getVar(`reset_${name}`), name).to.be.below(300); + } + }); } docs { - Puts the application back to its start. Run it before every test. + Puts the application back to its start. Run it before every test. It resets only this product's scenarios, so other teams' runs on the same mock are not touched. } diff --git a/e2e-testing/specs/build_specs.py b/e2e-testing/specs/build_specs.py index 382e3b8ea..4d4570e2a 100644 --- a/e2e-testing/specs/build_specs.py +++ b/e2e-testing/specs/build_specs.py @@ -281,6 +281,12 @@ def render_test(n: int, test: dict) -> list[str]: f"**Proves:** {test['proves']}", "", ] + if test.get("needsRealProduct"): + lines += [ + f"**Against the mock (box M):** build and compile it, it cannot be green there. " + f"{' '.join(test['needsRealProduct'].split())} It turns green with the real product in step 3.", + "", + ] for phase in ("setup", "execution", "teardown"): if test.get(phase): lines += [f"**{phase}**", "", *step_table(test[phase]), ""] @@ -422,7 +428,12 @@ def render_spec(path: Path, spec: dict, product: dict) -> str: "", "The [definition of done](index.md#done-when) for every product, and:", "", - *[f"- [ ] `tests/{t['file']}` is green." for t in spec["tests"] if not t.get("optional")], + *[ + f"- [ ] `tests/{t['file']}` " + + ("compiles; it is green with the real product (step 3)." if t.get("needsRealProduct") else "is green.") + for t in spec["tests"] + if not t.get("optional") + ], "", ] if spec.get("sources"): diff --git a/e2e-testing/specs/puris.yaml b/e2e-testing/specs/puris.yaml index 592a176f0..5fe1418cc 100644 --- a/e2e-testing/specs/puris.yaml +++ b/e2e-testing/specs/puris.yaml @@ -9,9 +9,9 @@ product: puris specVersion: '1.0' status: draft statusNote: >- - Not run yet. Two PURIS instances, each with a connector and a Digital Twin Registry, are not - in the workshop environment. Build and compile it in the workshop; run it where the product - is deployed. Check each path against the OpenAPI of the release you test. + Against the workshop mock only puris_backend_needs_key can be green: the other tests need PURIS + itself to act through its connector. Build and compile them in the workshop; they turn green with + the real product in step 3. Check paths against the release's OpenAPI. inOneSentence: >- A supplier's PURIS offers its stock and forecasts through its connector, and the customer's PURIS finds those offers and reads the item stock for a shared material. @@ -91,6 +91,9 @@ tests: - contract proves: PURIS publishes its data through the connector, where partners can find it. side: provider + needsRealProduct: >- + PURIS creates these offers in its own connector. The mock has no connector, so the catalog of + connector C holds no PURIS offer. execution: - do: Query the supplier's catalog from the customer's connector. step: connector/consumer/query_catalog @@ -106,6 +109,8 @@ tests: - contract proves: The short-term data actually reaches the partner, for the right material. side: provider + needsRealProduct: >- + PURIS registers the material twin in its own registry. The workshop registry holds none. execution: - do: Negotiate access to the supplier's registry. step: connector/discover/digital-twin-registry/auth @@ -144,6 +149,9 @@ tests: - positive proves: "PURIS works as a customer too: it finds the partner's twin, pulls its ItemStock and shows the quantities the partner offered." side: consumer + needsRealProduct: >- + At "Wait for PURIS's request" PURIS must find TestLab's offer, negotiate it and call it through + its own connector. The mock cannot call out: the run waits two minutes and fails with a timeout. setup: - do: Register a mock registry with a material twin for material_number and an ItemStock submodel. step: mock/dtr @@ -175,9 +183,15 @@ tests: - negative proves: PURIS does not publish twins for materials it does not know. side: provider + needsRealProduct: >- + It first finds the twin of the known material, which only the real PURIS registers. execution: - do: Negotiate access to the supplier's registry. step: connector/discover/digital-twin-registry/auth + - do: Look up material_number, the material both sides know. + step: digital-twin-registry/consumer/dataplane/lookup_shell + check: + - One twin is found, so the empty answer below is a refusal and not an empty registry. - do: Look up a material number that is new in every run. step: digital-twin-registry/consumer/dataplane/lookup_shell check: @@ -195,6 +209,9 @@ pitfalls: before the run. - >- The PURIS usage policy names the framework agreement Puris: check the version the release uses. +- >- + A quantity comes back as a number (20.0). Compare it with a number, not with the string "20": + give the expected quantity a variable/type/number. sources: - label: PURIS repository url: https://github.com/eclipse-tractusx/puris diff --git a/e2e-testing/specs/spec.schema.json b/e2e-testing/specs/spec.schema.json index f5f7fb593..d8c57ec95 100644 --- a/e2e-testing/specs/spec.schema.json +++ b/e2e-testing/specs/spec.schema.json @@ -439,6 +439,10 @@ "description": "Nice to have: build it when the others are green.", "type": "boolean" }, + "needsRealProduct": { + "description": "Why this test cannot be green against the product's mock (box M), for example because the real product must act on its own through its connector. Against the mock it is built and compiled; it turns green with the real product in step 3. Leave it out when the test runs green against the mock.", + "type": "string" + }, "setup": { "type": "array", "items": { diff --git a/e2e-testing/template/tck/e2e/tests/partner_uses_my_product.yaml b/e2e-testing/template/tck/e2e/tests/partner_uses_my_product.yaml index f7b66348b..7f743bb6a 100644 --- a/e2e-testing/template/tck/e2e/tests/partner_uses_my_product.yaml +++ b/e2e-testing/template/tck/e2e/tests/partner_uses_my_product.yaml @@ -110,7 +110,7 @@ execution: # TODO: check what your product promises, not only that it answers. # For example a field of the answer: # - uses: validate/field - # with: { input: body, path: "items[0].id", operator: not_null } + # with: { input: body, path: "items.0.id", operator: not_null } teardown: - id: delete_contract From 3be4174ebb93d6974620d3bf1e37ed27d625db2f Mon Sep 17 00:00:00 2001 From: Mathias Moser Date: Fri, 4 Dec 2026 10:38:02 +0100 Subject: [PATCH 2/2] fix(e2e-testing): PURIS pull test publishes its mock offers Running test 4 in the IDE with a real consumer on box C showed why it can never pass: the spec's setup names only connector/provider/create_mock_asset, which creates the asset on TestLab's connector but no contract definition, so the offer is in no catalog and the product cannot find it. CX-0135's TCK pairs it with two create_policy and a create_contract_definition; the PURIS spec now does the same, and withdraws them in teardown. The authoring guide in build_specs.py says so for every consumer-side test. Assisted-By: Claude Opus 5.5 Signed-off-by: Mathias Moser --- e2e-testing/docs/specs/index.md | 2 +- e2e-testing/docs/specs/puris.md | 9 +++++++-- e2e-testing/docs/specs/puris.yaml | 16 ++++++++++++++-- e2e-testing/specs/build_specs.py | 2 +- e2e-testing/specs/puris.yaml | 16 ++++++++++++++-- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/e2e-testing/docs/specs/index.md b/e2e-testing/docs/specs/index.md index c3cecb329..1770e5e0a 100644 --- a/e2e-testing/docs/specs/index.md +++ b/e2e-testing/docs/specs/index.md @@ -86,7 +86,7 @@ No system at all, API tests only: Business Partner Data Management (BPDM), Datas | At least **five tests**, with at least one **positive** and one **negative** | A test that only ever says yes proves nothing, and each person of the team builds at least one | | **Both sides** when the product does both: tests as **provider** and tests as **consumer** (`side`) | The team can split: one builds the provider side, one the consumer side | | **Provider side**: the product offers known data, TestLab takes it as the partner, and the checks compare what arrived with what was offered | It proves the data really left the product, unchanged | -| **Consumer side**: TestLab mocks the provider with known data (`mock/api`, `mock/dtr`, offered with `connector/provider/create_mock_asset`), waits for the product to take it (`mock/wait/*`), and the checks confirm the product got exactly that data | It proves the product really fetched it, not that it only said so | +| **Consumer side**: TestLab mocks the provider with known data (`mock/api`, `mock/dtr`, offered with `connector/provider/create_mock_asset` plus its policies and a `connector/provider/create_contract_definition`: without one the offer is in no catalog), waits for the product to take it (`mock/wait/*`), and the checks confirm the product got exactly that data | It proves the product really fetched it, not that it only said so | | Checks look at **content, shape and side effects**: the values sent come back, the answer matches the OpenAPI (`labs/validate/api_response`) or, for documents without one such as a DID document or a credential, a JSON schema in `schemas/`, copied from the ready ones in [`e2e-testing/schemas`](https://github.com/eclipse-tractusx/tutorial-resources/tree/main/e2e-testing/schemas), and a refused call leaves nothing behind | A status code alone proves little | | Each test **file** is listed under `tests:` in the manifest, and repeats its `id` as `namespace` | Otherwise it is not part of the project | | Only **steps the spec names** | They are TestLab's ready-made steps. An invented step does not compile | diff --git a/e2e-testing/docs/specs/puris.md b/e2e-testing/docs/specs/puris.md index 4fa76b3e9..bfbd73917 100644 --- a/e2e-testing/docs/specs/puris.md +++ b/e2e-testing/docs/specs/puris.md @@ -156,7 +156,10 @@ Every row is one step. Every ☐ is one `validate` entry. The step names are Tes | --- | --- | --- | --- | | 1 | Register a mock registry with a material twin for material_number and an ItemStock submodel. | `mock/dtr` | – | | 2 | Register a mock that answers the ItemStock submodel with a known quantity. | `mock/api` | – | -| 3 | Offer the registry and the submodel mock on TestLab's connector. | `connector/provider/create_mock_asset` | – | +| 3 | Turn the registry mock and the submodel mock into assets on TestLab's connector. | `connector/provider/create_mock_asset` | – | +| 4 | Create the access policy: Membership active. | `connector/provider/create_policy` | – | +| 5 | Create the usage policy, with the framework agreement Puris. | `connector/provider/create_policy` | – | +| 6 | Publish both assets under both policies, one contract definition each. An asset without a contract definition is in no catalog: PURIS cannot find it, and the wait below times out. | `connector/provider/create_contract_definition` | – | **execution** @@ -170,7 +173,9 @@ Every row is one step. Every ☐ is one `validate` entry. The step names are Tes | # | What happens | Step | Must be true | | --- | --- | --- | --- | -| 1 | Delete the mock assets and their offers. | `connector/provider/delete_asset` | – | +| 1 | Withdraw both contract definitions. | `connector/provider/delete_contract_definition` | – | +| 2 | Delete the mock assets. | `connector/provider/delete_asset` | – | +| 3 | Delete both policies. | `connector/provider/delete_policy` | – | ### Test 5 · A material number the supplier never registered has no twin diff --git a/e2e-testing/docs/specs/puris.yaml b/e2e-testing/docs/specs/puris.yaml index 5fe1418cc..c5684e124 100644 --- a/e2e-testing/docs/specs/puris.yaml +++ b/e2e-testing/docs/specs/puris.yaml @@ -157,8 +157,16 @@ tests: step: mock/dtr - do: Register a mock that answers the ItemStock submodel with a known quantity. step: mock/api - - do: Offer the registry and the submodel mock on TestLab's connector. + - do: Turn the registry mock and the submodel mock into assets on TestLab's connector. step: connector/provider/create_mock_asset + - do: "Create the access policy: Membership active." + step: connector/provider/create_policy + - do: Create the usage policy, with the framework agreement Puris. + step: connector/provider/create_policy + - do: >- + Publish both assets under both policies, one contract definition each. An asset without a + contract definition is in no catalog: PURIS cannot find it, and the wait below times out. + step: connector/provider/create_contract_definition execution: - do: "Ask PURIS to refresh its partners' data: GET {puris_url}/materials/refresh with the X-API-KEY header." step: http/http_request @@ -174,8 +182,12 @@ tests: - The answer is 200. - One entry is reported by TestLab's BPN, with exactly the quantity and unit the mock answered. teardown: - - do: Delete the mock assets and their offers. + - do: Withdraw both contract definitions. + step: connector/provider/delete_contract_definition + - do: Delete the mock assets. step: connector/provider/delete_asset + - do: Delete both policies. + step: connector/provider/delete_policy - file: unknown_material_has_no_stock.yaml id: unknown-material-has-no-stock name: A material number the supplier never registered has no twin diff --git a/e2e-testing/specs/build_specs.py b/e2e-testing/specs/build_specs.py index 4d4570e2a..9088e9ef2 100644 --- a/e2e-testing/specs/build_specs.py +++ b/e2e-testing/specs/build_specs.py @@ -530,7 +530,7 @@ def render_index(specs: list[tuple[Path, dict]], products: dict) -> str: "| At least **five tests**, with at least one **positive** and one **negative** | A test that only ever says yes proves nothing, and each person of the team builds at least one |", "| **Both sides** when the product does both: tests as **provider** and tests as **consumer** (`side`) | The team can split: one builds the provider side, one the consumer side |", "| **Provider side**: the product offers known data, TestLab takes it as the partner, and the checks compare what arrived with what was offered | It proves the data really left the product, unchanged |", - "| **Consumer side**: TestLab mocks the provider with known data (`mock/api`, `mock/dtr`, offered with `connector/provider/create_mock_asset`), waits for the product to take it (`mock/wait/*`), and the checks confirm the product got exactly that data | It proves the product really fetched it, not that it only said so |", + "| **Consumer side**: TestLab mocks the provider with known data (`mock/api`, `mock/dtr`, offered with `connector/provider/create_mock_asset` plus its policies and a `connector/provider/create_contract_definition`: without one the offer is in no catalog), waits for the product to take it (`mock/wait/*`), and the checks confirm the product got exactly that data | It proves the product really fetched it, not that it only said so |", "| Checks look at **content, shape and side effects**: the values sent come back, the answer matches the OpenAPI (`labs/validate/api_response`) or, for documents without one such as a DID document or a credential, a JSON schema in `schemas/`, copied from the ready ones in [`e2e-testing/schemas`](https://github.com/eclipse-tractusx/tutorial-resources/tree/main/e2e-testing/schemas), and a refused call leaves nothing behind | A status code alone proves little |", "| Each test **file** is listed under `tests:` in the manifest, and repeats its `id` as `namespace` | Otherwise it is not part of the project |", "| Only **steps the spec names** | They are TestLab's ready-made steps. An invented step does not compile |", diff --git a/e2e-testing/specs/puris.yaml b/e2e-testing/specs/puris.yaml index 5fe1418cc..c5684e124 100644 --- a/e2e-testing/specs/puris.yaml +++ b/e2e-testing/specs/puris.yaml @@ -157,8 +157,16 @@ tests: step: mock/dtr - do: Register a mock that answers the ItemStock submodel with a known quantity. step: mock/api - - do: Offer the registry and the submodel mock on TestLab's connector. + - do: Turn the registry mock and the submodel mock into assets on TestLab's connector. step: connector/provider/create_mock_asset + - do: "Create the access policy: Membership active." + step: connector/provider/create_policy + - do: Create the usage policy, with the framework agreement Puris. + step: connector/provider/create_policy + - do: >- + Publish both assets under both policies, one contract definition each. An asset without a + contract definition is in no catalog: PURIS cannot find it, and the wait below times out. + step: connector/provider/create_contract_definition execution: - do: "Ask PURIS to refresh its partners' data: GET {puris_url}/materials/refresh with the X-API-KEY header." step: http/http_request @@ -174,8 +182,12 @@ tests: - The answer is 200. - One entry is reported by TestLab's BPN, with exactly the quantity and unit the mock answered. teardown: - - do: Delete the mock assets and their offers. + - do: Withdraw both contract definitions. + step: connector/provider/delete_contract_definition + - do: Delete the mock assets. step: connector/provider/delete_asset + - do: Delete both policies. + step: connector/provider/delete_policy - file: unknown_material_has_no_stock.yaml id: unknown-material-has-no-stock name: A material number the supplier never registered has no twin