<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Optivem Journal: Acceptance Testing with AI]]></title><description><![CDATA[Step-by-step guides to covering a legacy system with acceptance tests using AI, from the use case diagram to acceptance tests passing in your pipeline. What used to take years can now take months, or even weeks.]]></description><link>https://journal.optivem.com/s/acceptance-testing-with-ai</link><image><url>https://substackcdn.com/image/fetch/$s_!GEk9!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc45df0d6-2660-4466-9b3a-ea5f01e9b5dc_512x512.png</url><title>Optivem Journal: Acceptance Testing with AI</title><link>https://journal.optivem.com/s/acceptance-testing-with-ai</link></image><generator>Substack</generator><lastBuildDate>Thu, 03 Dec 2026 19:03:18 GMT</lastBuildDate><atom:link href="https://journal.optivem.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Valentina Jemuović, Optivem]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[optivem@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[optivem@substack.com]]></itunes:email><itunes:name><![CDATA[Valentina Jemuović]]></itunes:name></itunes:owner><itunes:author><![CDATA[Valentina Jemuović]]></itunes:author><googleplay:owner><![CDATA[optivem@substack.com]]></googleplay:owner><googleplay:email><![CDATA[optivem@substack.com]]></googleplay:email><googleplay:author><![CDATA[Valentina Jemuović]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Stubs & Contract Tests for the Core Use Case in Legacy Code with AI]]></title><description><![CDATA[Stub the ERP, Tax and the Clock, and check each stub against the real system with one contract test, with the AI prompt for each step (Acceptance Testing in Legacy Code with AI - Phase 1).]]></description><link>https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-stubs-contract-tests</link><guid isPermaLink="false">https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-stubs-contract-tests</guid><dc:creator><![CDATA[Valentina Jemuović]]></dc:creator><pubDate>Thu, 03 Dec 2026 16:42:19 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fb75691f-c615-4eea-9bd2-38ce7e8e34e5_1200x630.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#128274; <em>Hello, this is Valentina with a premium issue of the Optivem Journal. I help Engineering Leaders &amp; Senior Software Developers cover legacy code with acceptance tests, using AI. This article is part of the <a href="https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai">Acceptance Testing in Legacy Code with AI</a> series. To get these articles in your inbox every week, subscribe.</em></p><p>We have a legacy system with no acceptance tests, and we want to cover it using AI. In <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-acceptance-criteria">Acceptance Criteria for the Core Use Case in Legacy Code with AI</a>, we wrote the acceptance criteria for Place Order and the use cases it depends on (Create Admin, Create Customer, Publish Coupon and View Order).</p><p>Now we want to turn the acceptance criteria into acceptance tests. But not so fast! Acceptance tests rely on stubs for the external systems: the ERP, Tax and the Clock. If a stub is wrong, we waste time troubleshooting a failing acceptance test, not knowing whether the problem is the stub or the acceptance test. So first we build the stubs, and contract tests that check them against the real systems.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Bidu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Bidu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 424w, https://substackcdn.com/image/fetch/$s_!Bidu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 848w, https://substackcdn.com/image/fetch/$s_!Bidu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 1272w, https://substackcdn.com/image/fetch/$s_!Bidu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Bidu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png" width="1456" height="738" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:738,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114788,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/227700089?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Bidu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 424w, https://substackcdn.com/image/fetch/$s_!Bidu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 848w, https://substackcdn.com/image/fetch/$s_!Bidu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 1272w, https://substackcdn.com/image/fetch/$s_!Bidu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F105eca36-2357-4cc0-b48d-e99339a9464b_2400x1216.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Matching means matching the contract: the stub takes the same calls as the real external system and gives back the same answers, so the same contract tests pass on both. That makes the stubs trusted, and the acceptance tests use the trusted stubs: a failing acceptance test is never the stub.</p><div><hr></div><h2>Adopt Acceptance Tests in Legacy Code with AI in 2027</h2><p>AI writes code faster than anyone can test it. Acceptance tests are how your teams keep up, especially in legacy code: the agent writes them, the human approves them, the pipeline enforces them, and every feature gets verified before release. I help you adopt acceptance testing: I set up the test architecture and cover your existing legacy product with acceptance tests. I then coach your teams to apply ATDD to their user stories and bug fixes. If you want to make this happen in 2027, <a href="https://calendly.com/valentinajemuovic/call">book a call</a>.</p><div><hr></div><h2>Legacy Code Already Has the Integration</h2><p>In legacy code, the integration with the external systems already exists. We&#8217;re not designing anything, we&#8217;re mapping what&#8217;s already there.</p><p>Only Place Order calls external systems, and it calls all three: the ERP for the product and the promotion, Tax for the tax rate, the Clock for the time.</p><p>The steps:</p><ol><li><p>List the stub operations from the Givens</p></li><li><p>Find the call behind each stub operation</p></li><li><p>Make the external systems swappable</p></li><li><p>Write the contract tests</p></li><li><p>Build the stubs</p></li></ol><p>The prompts work for any use case: replace <code>&lt;use case&gt;</code> with its name, like Place Order (UC-001), and <code>&lt;use-case&gt;</code> with its file name, like <code>UC-001-place-order</code>. The examples show Place Order, in an online shop.</p><h2>1. List the Stub Operations from the Givens</h2><p>We don&#8217;t read the source code again to decide what to stub: the Givens already say it. In <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-acceptance-criteria">Acceptance Criteria for the Core Use Case in Legacy Code with AI</a>, behind each Given was either one of our use cases or an answer from an external system. Every answer from an external system is a stub operation.</p><blockquote><p><strong>AI prompt:</strong> List the stub operations <code>&lt;use case&gt;</code> needs, in <code>docs/stubs/&lt;use-case&gt;.md</code>.</p><ol><li><p>Read the acceptance criteria in <code>docs/acceptance-criteria/&lt;use-case&gt;.md</code>.</p></li><li><p>For each Given that is an answer from an external system, write one stub operation: what the external system returns, and for which input.</p></li><li><p>Group the stub operations by external system. Under each one, quote the Givens that need it.</p></li><li><p>Leave out the Givens that run our own use cases: those run for real, never stubbed.</p></li></ol></blockquote><p>The Givens come from the acceptance criteria of Place Order, like these (trimmed here):</p><pre><code><code>@BR-5
Scenario:</code><strong><code> Tax uses the tax rate of the customer's country</code></strong><code>
  Given a product "ABC-123" with unit price 20.00
  And no promotion is active
  And a customer from the US
  And the tax rate for the US is 0.10
  When the customer orders 5 of "ABC-123"
  Then the order is placed successfully
  And the tax is 10.00

@narrative-3a
Scenario:</code><strong><code> Order for a product that doesn't exist fails</code></strong><code>
  Given there is no product "XYZ-999"
  When the customer orders 1 of "XYZ-999"
  Then placing the order fails
  And the customer is told "Product does not exist for SKU: XYZ-999"

@narrative-3b
Scenario:</code><strong><code> Order when the ERP is unavailable fails</code></strong><code>
  Given the ERP is unavailable
  When the customer places an order
  Then placing the order fails
  And the customer is told "Product information can't be retrieved right now"

@narrative-2a
Scenario:</code><strong><code> Order during year-end closing fails</code></strong><code>
  Given the time is 2026-12-31T23:59:30Z
  When the customer places an order
  Then placing the order fails
  And the customer is told "Orders cannot be placed between 23:59 and 00:00 on December 31st"

</code><em><code># ...</code></em><code>
</code></code></pre><p>Every Given here is an answer from the ERP, Tax or the Clock, except &#8220;a customer from the US&#8221;: that one runs Create Customer, so it isn&#8217;t stubbed.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!trOL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!trOL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 424w, https://substackcdn.com/image/fetch/$s_!trOL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 848w, https://substackcdn.com/image/fetch/$s_!trOL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!trOL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!trOL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png" width="1456" height="849" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:849,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:155054,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/227700089?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!trOL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 424w, https://substackcdn.com/image/fetch/$s_!trOL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 848w, https://substackcdn.com/image/fetch/$s_!trOL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 1272w, https://substackcdn.com/image/fetch/$s_!trOL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49ec6d05-f765-445d-ae61-9aab6e64fc77_2400x1400.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For Place Order, the output from AI may look like this, in <code>docs/stubs/UC-001-place-order.md</code>:</p><pre><code><strong><code>## ERP</code></strong><code>
- Returns a product for a SKU: "a product "ABC-123" with unit price 20.00"
- Has no product for a SKU: "there is no product "XYZ-999""
- Returns whether a promotion is active: "no promotion is active"
- Is unavailable: "the ERP is unavailable"

</code><strong><code>## Tax</code></strong><code>
- Returns the tax rate for a country: "the tax rate for the US is 0.10"
- Has no tax rate for a country: "there is no tax rate for "ZZ""

</code><strong><code>## Clock</code></strong><code>
- Returns the time: "the time is 2026-12-31T23:59:30Z"
</code></code></pre><p>That&#8217;s the whole list. A stub operation that no Given needs doesn&#8217;t get built.</p>
      <p>
          <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-stubs-contract-tests">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[3. Acceptance Criteria for the Core Use Case in Legacy Code with AI]]></title><description><![CDATA[The use case narrative and the business rules aren't testable yet. Flatten them into Given/When/Then with real inputs and outputs, with the AI prompt for each step (Acceptance Testing in Legacy Code w]]></description><link>https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-acceptance-criteria</link><guid isPermaLink="false">https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-acceptance-criteria</guid><dc:creator><![CDATA[Valentina Jemuović]]></dc:creator><pubDate>Fri, 27 Nov 2026 13:50:30 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e6e21e0f-db8c-4c42-9712-555956081326_1200x630.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#128274; <em>Hello, this is Valentina with a premium issue of the Optivem Journal. I help Engineering Leaders &amp; Senior Software Developers cover legacy code with acceptance tests, using AI. This article is part of the <a href="https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai">Acceptance Testing in Legacy Code with AI</a> series. To get these articles in your inbox every week, subscribe.</em></p><p>We have a legacy system with no acceptance tests, and we want to cover it using AI. In <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-use-case-narrative-business-rules">Core Use Case Narrative &amp; Business Rules in Legacy Code with AI</a>, we wrote down what Place Order does: the use case narrative and the business rules. Now we write acceptance criteria based on them, the interim step on the way to acceptance tests.</p><p>Why not go straight to acceptance tests? Tests are code, and code is more expensive to change than plain text. The first version of the acceptance criteria will need fixes, mostly to the business language: how we word a Given, a When or a Then. In plain text, rewording a step is a quick edit. In tests, it means renaming DSL methods across the test code.</p><p>The biggest risk isn&#8217;t correctness: the acceptance tests will catch that. It&#8217;s missing what matters most. So we&#8217;re not aiming for exhaustive, just for what the use case narrative and the business rules identified.</p><div><hr></div><p><strong>Work with me in 2027</strong></p><p>I set up the acceptance test architecture and work hands-on with your teams to cover your system with acceptance tests, until your teams write them on their own. Every feature gets verified automatically before release, and regression bugs stop reaching production. If you want to work together in 2027, <a href="https://calendly.com/valentinajemuovic/call">book a call</a>.</p><div><hr></div><h2>What the Use Case Narrative and the Business Rules Don&#8217;t Have</h2><p>What we have so far for Place Order, the main success scenario of the use case narrative:</p><pre><code><code>1. The customer submits an order for a product: its SKU and a quantity.
2. The system validates with the Clock that orders are being accepted at this time (BR-9).
3. The system gets the product and its unit price from the ERP.
4. The system gets the tax rate for the customer's country from Tax.
5. The system calculates the total price (BR-1 to BR-7).
6. The system stores the order with status PLACED.
7. The system shows the customer a success message and the order number.
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wid3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wid3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 424w, https://substackcdn.com/image/fetch/$s_!Wid3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 848w, https://substackcdn.com/image/fetch/$s_!Wid3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 1272w, https://substackcdn.com/image/fetch/$s_!Wid3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wid3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png" width="1456" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86845,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/226782177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Wid3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 424w, https://substackcdn.com/image/fetch/$s_!Wid3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 848w, https://substackcdn.com/image/fetch/$s_!Wid3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 1272w, https://substackcdn.com/image/fetch/$s_!Wid3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27cd46ca-258a-4500-b5f2-b3815a988eda_2200x696.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Its extensions are either alternatives, which still end with the order placed, like 1a &#8220;The customer submits a coupon code&#8221;, or exceptions, which don&#8217;t, like 1b &#8220;The coupon can&#8217;t be used&#8221;.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jdxv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jdxv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 424w, https://substackcdn.com/image/fetch/$s_!jdxv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 848w, https://substackcdn.com/image/fetch/$s_!jdxv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 1272w, https://substackcdn.com/image/fetch/$s_!jdxv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!jdxv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png" width="1456" height="804" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:804,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:204286,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/226782177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jdxv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 424w, https://substackcdn.com/image/fetch/$s_!jdxv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 848w, https://substackcdn.com/image/fetch/$s_!jdxv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 1272w, https://substackcdn.com/image/fetch/$s_!jdxv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93215304-1944-4f6a-b246-6a28b694b5ad_2420x1336.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>The business rules:</p><pre><code><code>- BR-1. Base price = unit price x quantity.
- BR-2. When the ERP has an active promotion, promoted price = base price x promotion factor. Otherwise, promoted price = base price.
- BR-3. Discount = promoted price x the coupon's discount rate. With no coupon, the discount is 0.
- BR-4. Subtotal = promoted price - discount.
- BR-5. Tax = subtotal x the tax rate for the country.
- BR-6. Total price = subtotal + tax.
- BR-7. Amounts are rounded to 2 decimal places and rates to 4, half up, once, at the end.
- BR-8. A coupon can be used when it exists, the time is between its valid-from and valid-to, and it hasn't reached its usage limit.
- BR-9. Orders aren't accepted between 23:59 and 00:00 UTC on December 31st.
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uITA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uITA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 424w, https://substackcdn.com/image/fetch/$s_!uITA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 848w, https://substackcdn.com/image/fetch/$s_!uITA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 1272w, https://substackcdn.com/image/fetch/$s_!uITA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!uITA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png" width="1456" height="876" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:876,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:206648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/226782177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uITA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 424w, https://substackcdn.com/image/fetch/$s_!uITA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 848w, https://substackcdn.com/image/fetch/$s_!uITA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 1272w, https://substackcdn.com/image/fetch/$s_!uITA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F361af07d-5ca3-4396-8e3d-00f62ae145c8_2420x1456.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Both are general: no inputs, no outputs, so they aren&#8217;t testable. Step 5 of the main success scenario says &#8220;The system calculates the total price&#8221;. Is that working? Two people read it and expect two different totals. To find out, they&#8217;d have to run the system or read the code.</p><p>Acceptance criteria express them in concrete inputs and outputs. For BR-1: unit price 20.00 and quantity 5 give base price 100.00. Not &#8220;a valid unit price&#8221;: &#8220;valid&#8221; is open to interpretation, 20.00 isn&#8217;t.</p><p>Each scenario checks one behaviour, so when it fails, its name tells you what broke. The acceptance criteria for the flows (the main success scenario, the alternatives and the exceptions) check the paths through the use case. The acceptance criteria for the business rules check the values and the edges.</p><p>The coupon shows up in the use case narrative and in the business rules, but as two different things:</p><ul><li><p><strong>BR-8, the business rule:</strong> when a coupon can be used. Between its valid-from and its valid-to, and below its usage limit.</p></li><li><p><strong>1b, the extension:</strong> what happens when it can&#8217;t be used. The order fails, and the customer is told why.</p></li></ul><p>So the exception scenario checks the message, with a coupon that expired a month ago, and the business rule scenarios check the exact second the coupon expires. If the message changes, only the first fails. If the coupon expires a second too early, only the second does.</p><p>The steps:</p><ol><li><p>Write acceptance criteria for the main success scenario</p></li><li><p>Write acceptance criteria for the alternative scenarios</p></li><li><p>Write acceptance criteria for the exception scenarios</p></li><li><p>Write acceptance criteria for the business rules</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OMwC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OMwC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 424w, https://substackcdn.com/image/fetch/$s_!OMwC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 848w, https://substackcdn.com/image/fetch/$s_!OMwC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 1272w, https://substackcdn.com/image/fetch/$s_!OMwC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!OMwC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png" width="1456" height="646" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:646,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96931,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/226782177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OMwC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 424w, https://substackcdn.com/image/fetch/$s_!OMwC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 848w, https://substackcdn.com/image/fetch/$s_!OMwC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 1272w, https://substackcdn.com/image/fetch/$s_!OMwC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fccba7f79-4442-4a3f-9d16-a8f2a34b3f5a_2200x976.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Write acceptance criteria for every use case in the dependency tree, not just Place Order. We&#8217;ll need them later for the acceptance tests: Place Order&#8217;s acceptance tests run Publish Coupon and Create Customer in their Given, so those use cases need acceptance criteria too. The steps run once per use case, dependencies first: Create Admin, Create Customer and Publish Coupon, then Place Order and View Order, which depend on each other: Place Order&#8217;s Then runs View Order, and View Order&#8217;s Given runs Place Order. The prompts work for any of them: replace <code>&lt;use case&gt;</code> with its name, like Place Order (UC-001), and <code>&lt;use-case&gt;</code> with its file name, like <code>UC-001-place-order</code>. The examples show Place Order, in an online shop.</p><h2>1. Write Acceptance Criteria for the Main Success Scenario</h2><p>The simplest order that gets placed: nothing optional, so no coupon, and no prices, since the prices are business rules, with their own acceptance criteria. AI works from the use case narrative, the business rules and the source code.</p><blockquote><p><strong>AI prompt:</strong> Write the acceptance criteria for the main success scenario of <code>&lt;use case&gt;</code>, in Given/When/Then, in <code>docs/acceptance-criteria/&lt;use-case&gt;.md</code>.</p><ol><li><p>Read the use case narrative in <code>docs/use-cases/&lt;use-case&gt;.md</code>, the business rules in <code>docs/business-rules/&lt;use-case&gt;.md</code>, and the source code.</p></li><li><p>Leave out everything optional, and leave out the calculations: they are business rules.</p></li><li><p>Write one scenario per behaviour the user sees.</p></li><li><p>In Given, name only what the result depends on, as a business fact. Behind each Given is either a use case from the dependencies in <code>docs/use-cases/README.md</code>, or an answer from an external system. Name the external system only when its own behaviour is the point, like it being unavailable.</p></li><li><p>Tag each scenario with <code>@narrative-main</code>.</p></li></ol><p>Don&#8217;t mention screens, buttons, the database or the API. Stay at the user&#8217;s level, like the use case narrative. Describe what the system does today, not what it should do.</p></blockquote><p>For Place Order (UC-001), the output from AI may look like this, in <code>docs/acceptance-criteria/UC-001-place-order.md</code>:</p><pre><code><code>Feature:</code><strong><code> Place Order</code></strong><code>

@narrative-main
Scenario:</code><strong><code> Order status is PLACED</code></strong><code>
  When the customer places an order
  Then the order is placed successfully
  And the order status is PLACED

@narrative-main
Scenario:</code><strong><code> Order number starts with ORD-</code></strong><code>
  When the customer places an order
  Then the order is placed successfully
  And the order number starts with "ORD-"
</code></code></pre><p>Two behaviours, two scenarios: if the status is wrong, only the first fails; if the prefix is wrong, only the second. In both, &#8220;the order is placed successfully&#8221; is a guard: no order, no status or order number to check.</p><p>Neither has a Given, because the result doesn&#8217;t depend on the product, the customer or the time. The test fills in defaults.</p><h2>2. Write Acceptance Criteria for the Alternative Scenarios</h2><p>An alternative still ends with the order placed. In Place Order, that&#8217;s extension 1a: an order with a coupon.</p><blockquote><p><strong>AI prompt:</strong> Add the acceptance criteria for the alternative scenarios of <code>&lt;use case&gt;</code> to <code>docs/acceptance-criteria/&lt;use-case&gt;.md</code>.</p><ol><li><p>For each extension in the use case narrative that still ends with the result of the use case, write one scenario per behaviour.</p></li><li><p>Check what the alternative changes in the flow. Leave out the calculations: they are business rules.</p></li><li><p>Tag each scenario with its extension, like <code>@narrative-1a</code>.</p></li></ol></blockquote><p>For Place Order, the output from AI may look like this:</p><pre><code><code>@narrative-1a
Scenario:</code><strong><code> Customer places an order with a coupon</code></strong><code>
  Given a coupon "SUMMER"
  When the customer places an order with coupon "SUMMER"
  Then the order is placed successfully
  And the order shows applied coupon "SUMMER"
</code></code></pre><p>The discount is BR-3, so it goes with the business rules.</p>
      <p>
          <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-acceptance-criteria">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[2. Core Use Case Narrative & Business Rules in Legacy Code with AI]]></title><description><![CDATA[Before AI writes a single acceptance test, write down what the core use case does today, with the AI prompt for each step (Acceptance Testing in Legacy Code with AI - Phase 1).]]></description><link>https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-use-case-narrative-business-rules</link><guid isPermaLink="false">https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-use-case-narrative-business-rules</guid><dc:creator><![CDATA[Valentina Jemuović]]></dc:creator><pubDate>Fri, 20 Nov 2026 15:58:08 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c554321c-87fc-403c-924f-1674654e7b81_1200x630.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#128274; <em>Hello, this is Valentina with a premium issue of the Optivem Journal. I help Engineering Leaders &amp; Senior Software Developers cover legacy code with acceptance tests, using AI. This article is part of the <a href="https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai">Acceptance Testing in Legacy Code with AI</a> series. To get these articles in your inbox every week, subscribe.</em></p><p>We have a legacy system with no acceptance tests, and we want to cover it using AI. In <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-pipeline-use-case-diagram">Minimal Pipeline &amp; Use Case Diagram in Legacy Code with AI</a>, we set up a minimal pipeline and mapped the system&#8217;s use cases. Now we want to start writing the acceptance tests.</p><p>Doing that for everything at once is risky. The tests would need the whole test architecture before even one could pass, and an architecture problem would show up at the very end. So we go use case by use case. The first one is our walking skeleton: once its acceptance tests run green in the pipeline, we know the acceptance test architecture works.</p><p>But before AI writes any test for this first use case:</p><ol><li><p>Pick the core use case</p></li><li><p>List the use case dependencies</p></li><li><p>Interview the product owner about scenarios</p></li><li><p>Generate the use case narrative</p></li><li><p>Generate the business rules</p></li><li><p>Review with the product owner</p></li></ol><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Otfd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 424w, https://substackcdn.com/image/fetch/$s_!Otfd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 848w, https://substackcdn.com/image/fetch/$s_!Otfd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 1272w, https://substackcdn.com/image/fetch/$s_!Otfd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Otfd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png" width="1456" height="176" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:176,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:63125,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/225814163?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Otfd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 424w, https://substackcdn.com/image/fetch/$s_!Otfd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 848w, https://substackcdn.com/image/fetch/$s_!Otfd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 1272w, https://substackcdn.com/image/fetch/$s_!Otfd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60335c6d-56c4-4616-91c9-a9bc44e2d6a0_2480x300.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></div></figure></div><p>The examples come from an online shop.</p><h2>1. Pick the Core Use Case</h2><p>The core use case is the one the system exists for. Confirm it with the product owner: ask which use case on the diagram is the most business critical. It&#8217;s a subjective choice, so a human makes it, not AI.</p><p>In the shop: Place Order.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zzYG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zzYG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 424w, https://substackcdn.com/image/fetch/$s_!zzYG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 848w, https://substackcdn.com/image/fetch/$s_!zzYG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!zzYG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!zzYG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png" width="1082" height="1492" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1492,&quot;width&quot;:1082,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124697,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/225814163?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zzYG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 424w, https://substackcdn.com/image/fetch/$s_!zzYG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 848w, https://substackcdn.com/image/fetch/$s_!zzYG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 1272w, https://substackcdn.com/image/fetch/$s_!zzYG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F841ffaf1-c994-48b2-b4fe-25480281be00_1082x1492.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Note: Why not an easy one first? Covering the highest-value use case first gives the biggest payoff from the automation. And if you pick something easy, the team and management say &#8220;that doesn&#8217;t reflect how complex our system is&#8221;, so nobody buys in.</em></p><h2>2. List the Use Case Dependencies</h2><p>To execute Place Order, the system needs a product (and its promotion, if the ERP has one) and a coupon first. To check that the order was placed, we view the order. If the setup that creates the product is broken, the Place Order test fails for the wrong reason, and we look in the wrong place.</p><p>A Place Order test needs a product and a coupon, but nothing in the test says where the product comes from, or which use case creates the coupon. So we write the dependencies down.</p><blockquote><p><strong>AI prompt:</strong> For Place Order (UC-001), find what it depends on. Read the source code of Place Order.</p><ol><li><p><strong>Setup:</strong> for each piece of data Place Order reads, find the use case that creates it. That use case is either in our system (see <code>docs/use-cases/README.md</code>) or in an external system.</p></li><li><p><strong>Verification:</strong> find which use cases show the result of Place Order to the user.</p></li><li><p><strong>Dependencies of dependencies:</strong> do the same for each use case you found, and for theirs, until no new dependency turns up. When a use case leads back to one already listed, stop there.</p></li></ol><p>Add a &#8220;Dependencies&#8221; section under the diagram in <code>docs/use-cases/README.md</code>. For each use case, write two tables, one for the shop and one for the external systems: what it&#8217;s needed for, the dependency, and the source file where you found it. Name an external system dependency by what Place Order needs from it, like &#8220;ERP: Returns Product&#8221;.</p></blockquote><p>The output from AI may look like this, in <code>docs/use-cases/README.md</code>:</p><pre><code><code>## Dependencies

### UC-001 Place Order

Shop:

| Needed for | Dependency | Source file |
|---|---|---|
| Setup: a signed-in customer | UC-013 Create Customer | `shop-realm.json` |
| Setup: the coupon exists | UC-004 Publish Coupon | `CouponService.java` |
| Verification: the order was placed | UC-002 View Order | `OrderApiController.java` |

External systems:

| Needed for | Dependency | Source file |
|---|---|---|
| Setup: the product exists | ERP: Returns Product | `OrderService.java` |
| Setup: the promotion | ERP: Returns Promotion | `OrderService.java` |
| Setup: the country has a tax rate | Tax: Returns Tax Rate | `OrderService.java` |
| Setup: the current time | Clock: Returns Time | `OrderService.java` |

### UC-004 Publish Coupon

Shop:

| Needed for | Dependency | Source file |
|---|---|---|
| Setup: a signed-in admin | UC-014 Create Admin | `shop-realm.json` |

### UC-002 View Order

Shop:

| Needed for | Dependency | Source file |
|---|---|---|
| Setup: a signed-in customer | UC-013 Create Customer | `shop-realm.json` |
| Setup: the order exists | UC-001 Place Order | already listed |
</code></code></pre><p>The result is a use case dependency tree with Place Order at the root.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mLlA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mLlA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 424w, https://substackcdn.com/image/fetch/$s_!mLlA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 848w, https://substackcdn.com/image/fetch/$s_!mLlA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 1272w, https://substackcdn.com/image/fetch/$s_!mLlA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!mLlA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png" width="1456" height="1460" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1460,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:142606,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/225814163?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mLlA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 424w, https://substackcdn.com/image/fetch/$s_!mLlA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 848w, https://substackcdn.com/image/fetch/$s_!mLlA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 1272w, https://substackcdn.com/image/fetch/$s_!mLlA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9d8f7b1-73af-432a-947c-05032063987f_1624x1628.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>
      <p>
          <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-use-case-narrative-business-rules">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[1. Minimal Pipeline & Use Case Diagram in Legacy Code with AI]]></title><description><![CDATA[What to set up before your first acceptance test, with the AI prompt for each step (Acceptance Testing in Legacy Code with AI - Phase 0)]]></description><link>https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-pipeline-use-case-diagram</link><guid isPermaLink="false">https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-pipeline-use-case-diagram</guid><dc:creator><![CDATA[Valentina Jemuović]]></dc:creator><pubDate>Fri, 13 Nov 2026 13:21:23 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!iMOA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#128274; <em>Hello, this is Valentina with a premium issue of the Optivem Journal. I help Engineering Leaders &amp; Senior Software Developers cover legacy code with acceptance tests, using AI. This article is part of the <a href="https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai">Acceptance Testing in Legacy Code with AI</a> series. To get these articles in your inbox every week, subscribe. Until Tuesday, November 17, an annual subscription is <a href="https://journal.optivem.com/subscribe?coupon=26d7c410">20% off</a>.</em></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://journal.optivem.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://journal.optivem.com/subscribe?"><span>Subscribe now</span></a></p><p>Before we automate any use case with acceptance tests, we need two things:</p><p><strong>1. Minimal Pipeline:</strong> gets the system onto the acceptance environment the same way every time. Acceptance tests run against the deployed system, so when one fails, we need to know the feature broke, not the deploy.</p><ul><li><p>1.1 Dockerfiles</p></li><li><p>1.2 Docker Compose</p></li><li><p>1.3 Smoke Tests</p></li><li><p>1.4 Commit Stage</p></li><li><p>1.5 Acceptance Stage</p></li><li><p>1.6 Release Stages</p></li></ul><p><strong>2. Use Case Diagram:</strong> the actors, the use cases and the external systems. Every acceptance test covers one use case, so the diagram shows us what there is to test and which use case to start with.</p><ul><li><p>2.1 Ask the Product Owner</p></li><li><p>2.2 Generate the Use Case Diagram</p></li><li><p>2.3 Review with the Product Owner</p></li></ul><p>Where relevant, we give you the AI prompt for each step.</p><p>This is Phase 0 of the series <a href="https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai">Acceptance Testing in Legacy Code with AI</a>.</p><p>In the next article, we pick the core use case and write its use case narrative and business rules.</p><h2>1. Minimal Pipeline</h2><p>The pipeline has four stages. Every stage after the commit stage has its own environment.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iMOA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iMOA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 424w, https://substackcdn.com/image/fetch/$s_!iMOA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 848w, https://substackcdn.com/image/fetch/$s_!iMOA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 1272w, https://substackcdn.com/image/fetch/$s_!iMOA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!iMOA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png" width="1456" height="373" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:373,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46470,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/224745127?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iMOA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 424w, https://substackcdn.com/image/fetch/$s_!iMOA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 848w, https://substackcdn.com/image/fetch/$s_!iMOA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 1272w, https://substackcdn.com/image/fetch/$s_!iMOA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34b6ee30-dcd4-45e6-a4f8-5fec2850ecbe_1860x476.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>Commit stage:</strong> one for each deployable component, such as the backend and the frontend. Compile the code, build the Docker images, publish them to the Docker registry.</p></li><li><p><strong>Acceptance stage:</strong> deploy to the acceptance environment, run the smoke tests.</p></li><li><p><strong>QA stage:</strong> deploy to the QA environment, run the smoke tests.</p></li><li><p><strong>Production stage:</strong> deploy to the production environment, run the smoke tests.</p></li></ul><p>Unit tests, component tests and static code analysis go in the commit stage too. Acceptance testing doesn&#8217;t need them, so we leave them out of this series.</p><p><em>Notice what&#8217;s missing from the acceptance stage: acceptance tests. They don&#8217;t exist yet. We build them later in the series.</em></p><p>The acceptance, QA and production stages all do the same two things: deploy the system, then run the smoke tests. So we write those two steps once and reuse them in all three.</p><p>Why go all the way to production? If you deploy to acceptance one way and to production another, a release can work on acceptance and still break in production. If all three stages deploy the same way, every deploy to acceptance is practice for production.</p><h3><strong>1.1 Dockerfiles</strong></h3><p>No Dockerfiles yet? Write them first. They also tell you whether anyone can still build the system from a clean checkout.</p><blockquote><p><strong>AI prompt:</strong> Write a Dockerfile for each deployable component:</p><ul><li><p>one for the backend,</p></li><li><p>one for the frontend.</p></li></ul><p>Find out how each is built and started today from the build scripts, the deployment scripts and the README. Build each from a clean checkout, using nothing from a developer&#8217;s machine. Don&#8217;t change the system&#8217;s code.</p></blockquote><p>Docker is the most common choice, and we recommend it wherever the system can run in a container. But it&#8217;s optional. If the system can&#8217;t run in a container, deploy it to a real server with the scripts you already have. You lose one thing: running the same setup on your machine and in the pipeline. You keep the most important one: every environment is deployed the same way. Without Docker, swap the Docker images for your build artifacts (such as JAR files or zip packages) and the Docker registry for your artifact repository. Run the system on your machine the way you do today; the steps stay the same.</p><h3><strong>1.2 Docker Compose</strong></h3><p>Write a Compose file to run the system on your machine. You use it to run the smoke tests locally before they go into the pipeline:</p><blockquote><p><strong>AI prompt:</strong> Write docker-compose.yml in the repository root:</p><ul><li><p>Build the backend and the frontend from their Dockerfiles and start them.</p></li><li><p>Start everything they need to start, such as the database and the login server.</p></li><li><p>Point each external system to its test instance.</p></li><li><p>Find every setting the system reads at startup in the deployment scripts and the README, and set each one in the compose file.</p></li></ul><p>Don&#8217;t change the system&#8217;s code, with one exception: if an external system&#8217;s URL is hard-coded, move it into the system&#8217;s configuration.</p></blockquote><p>One rule: external system URLs must be settings, not hard-coded. It&#8217;s the only change we make to the system&#8217;s code.</p><p>Example of the generated file, trimmed to the backend and the frontend:</p><pre><code><code>services:
  backend:
    build: ./backend
    ports:
      - "8080:8080"
    environment:
      - ERP_API_URL=https://test.erp.com
      - TAX_API_URL=https://test.tax.com
      - CLOCK_API_URL=https://test.clock.com
  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
</code></code></pre><p><em>Why build the images locally instead of pulling them from the Docker registry? The registry is still empty: the commit stages that publish the images come later. And on your machine, you want to run the code you just changed.</em></p><p><em>Why make external system URLs configurable? Later in the series we replace the external systems with stubs, and that only works if the URL is a setting.</em></p>
      <p>
          <a href="https://journal.optivem.com/p/acceptance-testing-legacy-code-ai-pipeline-use-case-diagram">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[New series: Acceptance Testing in Legacy Code with AI]]></title><description><![CDATA[It doesn't have to take years. It can now take months, or even weeks.]]></description><link>https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai</link><guid isPermaLink="false">https://journal.optivem.com/p/new-series-acceptance-testing-in-legacy-code-with-ai</guid><dc:creator><![CDATA[Valentina Jemuović]]></dc:creator><pubDate>Tue, 10 Nov 2026 14:48:08 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Ap0E!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>AI made coding faster, but your releases didn&#8217;t speed up, because every feature still goes through manual testing. I help teams replace that with acceptance tests that run automatically in your pipeline. I have a few spots left for 2027. <a href="https://calendly.com/valentinajemuovic/call">Book a call</a>.</em></p><p>One of the biggest challenges with practicing ATDD is the existing legacy code base, which basically has no tests. You write acceptance tests for the new user story, you see them red, then green. But you could have very easily broken something that already worked.</p><p>Automating the whole system used to take years and years. So it wasn&#8217;t feasible to automate the whole system. Rather, we did it incrementally: for each user story, we first did legacy coverage.</p><p>But here&#8217;s the thing. When AI came in, I changed my approach. Hey, it doesn&#8217;t have to take years. It can now take months, or even weeks. I think it&#8217;s the first time in history ever that we can do possibly full system coverage of a legacy system.</p><p>So why does it matter that we cover the whole system?</p><ul><li><p><strong>No more manual regression testing.</strong> The manual test procedures that run before every release are covered by acceptance tests in the pipeline.</p></li><li><p><strong>You can modernize safely.</strong> Move to a modern tech stack, or restructure the architecture, for example from a monolith to microservices. The acceptance tests talk to the system only through its API and UI, so they keep checking the behaviour while you replace what&#8217;s behind them.</p></li><li><p><strong>You can trust what AI changes.</strong> AI writes code faster than anyone can review it by hand, and the acceptance tests tell you what a change broke.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ap0E!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ap0E!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 424w, https://substackcdn.com/image/fetch/$s_!Ap0E!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 848w, https://substackcdn.com/image/fetch/$s_!Ap0E!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 1272w, https://substackcdn.com/image/fetch/$s_!Ap0E!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ap0E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png" width="1200" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9020530e-1be0-486c-904e-0dbab76325de_1200x630.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49699,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://journal.optivem.com/i/224312696?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ap0E!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 424w, https://substackcdn.com/image/fetch/$s_!Ap0E!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 848w, https://substackcdn.com/image/fetch/$s_!Ap0E!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 1272w, https://substackcdn.com/image/fetch/$s_!Ap0E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9020530e-1be0-486c-904e-0dbab76325de_1200x630.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button class="pencraft pc-reset pencraft icon-container restack-image buttonBase-nxj3kw" tabindex="0" type="button"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button class="pencraft pc-reset pencraft icon-container view-image buttonBase-nxj3kw" tabindex="0" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>The new approach</h2><p><strong>Phase 0: the pipeline and the use case diagram</strong></p><p>We need a pipeline with the commit stage, the acceptance stage and the release stage, so from day one we see the tests passing in the acceptance stage.</p><p>Then the use case diagram, including which use cases depend on each other. The AI writes it from the source code, the docs and the running system. We pick the most important use case.</p><p><strong>Phase 1: the pilot</strong></p><p>We start with the most important use case and the ones it depends on, in that order. For example, Place Order with a coupon needs a published coupon, so Publish Coupon goes first.</p><ol><li><p><strong>Use case narrative.</strong> The main scenario and the alternative scenarios. We review it with the domain experts.</p></li><li><p><strong>Acceptance criteria.</strong> The use case scenarios, written as concrete examples with real values.</p></li><li><p><strong>Acceptance tests, passing.</strong> Against the existing system, without changing it. Once the tests for the most important use case pass in the acceptance stage of the pipeline, we demo it to your team.</p></li></ol><p><strong>Phase 2: scaling</strong></p><p>The pilot is where you learn the lessons if something goes wrong with AI. After the go-ahead, we repeat the same three steps for all the other use cases, one at a time, in the order they depend on each other.</p><p>To get that order, we use AI to build a dependency tree of the use cases. The tree sets the sequence: a use case only comes after the use cases it depends on.</p><p><em>This series is a work in progress. This list itself may be updated as I go through the writing of the series. The focus is primarily technical, but where I see it&#8217;s relevant, I might also include how to get buy-in from your team.</em></p><h2>Where you end up</h2><p>In a few weeks or a few months, instead of three to five years, you actually have protection. Then your team can keep working test-last, or move on to ATDD.</p><p>Ask me in the comments as you try to apply this in your real life project.</p><p>This series is practical so you can apply it at work - you get AI prompts and code examples. You can ask me questions as you try to apply it at your job. This series is designed for busy software engineers who want to get results fast.</p><h2>Using your training budget</h2><p>You can expense it to your team&#8217;s training budget.</p><p>Here&#8217;s a sample email you can send your manager. Feel free to adapt it:</p><blockquote><p>Hi [manager name],</p><p>We&#8217;re using AI to code faster, but every release still waits for manual regression testing. We need to solve that problem.</p><p>Optivem Journal has a new series on using AI to cover a legacy system with automated acceptance tests in weeks or months, not years. The tests run in the pipeline, so we can stop testing every release by hand. It includes the AI prompts and code examples, so I can try it on our real system at work. Paid subscribers can also ask questions and get support when they get stuck.</p><p>I&#8217;d like to expense an annual subscription from our training budget. It&#8217;s 20% off until Tuesday, November 17: <a href="https://journal.optivem.com/26d7c410">https://journal.optivem.com/26d7c410</a></p><p>Thanks,<br>[your name]</p><p>P.S. If it&#8217;s useful for the whole team, there&#8217;s also a group subscription, so we could all go through the series together.</p></blockquote><p><em>You can get an invoice for your company from Substack (<a href="https://support.substack.com/hc/en-us/articles/360037489832-How-do-I-get-an-invoice-for-my-subscription">see how</a>). To subscribe your whole team, click &#8220;Other payment options&#8221; when subscribing and choose &#8220;Group Subscription&#8221; (at least four people).</em></p>]]></content:encoded></item><item><title><![CDATA[Acceptance test coverage with AI - fast]]></title><description><![CDATA[The behaviour is already there. AI can write it down, and the running system tells you where it got it wrong.]]></description><link>https://journal.optivem.com/p/acceptance-test-coverage-with-ai</link><guid isPermaLink="false">https://journal.optivem.com/p/acceptance-test-coverage-with-ai</guid><dc:creator><![CDATA[Valentina Jemuović]]></dc:creator><pubDate>Fri, 06 Nov 2026 16:14:18 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0fc14ac4-a59d-4a03-8bb5-b39c3f59ba3a_1200x630.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>AI made coding faster, but your releases didn&#8217;t speed up, because every feature still gets tested by hand. I help teams replace that with acceptance tests that run automatically. I have a few spots left for 2027. <a href="https://calendly.com/valentinajemuovic/call">Book a call</a>.</em></p><p>Most systems are legacy: years in production, no acceptance tests, and nobody can say exactly how they behave. Before every release, someone works through the manual test procedures by hand, and the list grows with every release.</p><p>Writing acceptance tests for the whole system by hand would take months, so it never starts. But the behaviour already exists: in the running system, the source code, the manual test procedures and the domain experts&#8217; heads. AI can write it down, and the running system checks what the AI wrote.</p><p>The steps:</p><p><strong>Phase 1. Prove it on the core use case</strong></p><ul><li><p><strong>Step 1.1.</strong> Generate the use case diagram.</p></li><li><p><strong>Step 1.2.</strong> Generate the use case narrative for the core use case.</p></li><li><p><strong>Step 1.3.</strong> Generate the acceptance criteria for the core use case.</p></li><li><p><strong>Step 1.4.</strong> Set up the acceptance test architecture, with the acceptance tests for the core use case.</p></li><li><p><strong>Step 1.5.</strong> Ensure that the acceptance tests pass against the existing system.</p></li></ul><p><strong>Phase 2. Scale to the other use cases</strong></p><ul><li><p><strong>Step 2.1.</strong> Generate the use case narratives for the other use cases.</p></li><li><p><strong>Step 2.2.</strong> Generate the acceptance criteria for the other use cases.</p></li><li><p><strong>Step 2.3.</strong> Generate the acceptance tests for the other use cases.</p></li><li><p><strong>Step 2.4.</strong> Ensure that the acceptance tests pass against the existing system.</p></li><li><p><strong>Step 2.5.</strong> Delete the acceptance criteria.</p></li></ul><p>Take one use case all the way through before doing the rest. Each step comes with its prompt. The examples come from an online shop.</p>
      <p>
          <a href="https://journal.optivem.com/p/acceptance-test-coverage-with-ai">
              Read more
          </a>
      </p>
   ]]></content:encoded></item></channel></rss>