Import XML invoice
Attach an XML document to a step with story.code().
The test
Section titled “The test”import { story } from 'executable-stories-vitest';import { it } from 'vitest';
it("Import XML invoice", ({ task }) => { story.init(task); story.given("the invoice XML is"); story.code({ label: "Invoice", content: `<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>`, lang: "xml", }); story.when("the user imports the invoice"); story.then("the invoice should be saved"); story.then("the invoice total should be 42.50 USD");});import { story } from 'executable-stories-jest';
it("Import XML invoice", () => { story.init(); story.given("the invoice XML is"); story.code({ label: "Invoice", content: `<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>`, lang: "xml", }); story.when("the user imports the invoice"); story.then("the invoice should be saved"); story.then("the invoice total should be 42.50 USD");});import { test } from '@playwright/test';import { story } from 'executable-stories-playwright';
test("Import XML invoice", async ({}, testInfo) => { story.init(testInfo); story.given("the invoice XML is"); story.code({ label: "Invoice", content: `<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>`, lang: "xml", }); story.when("the user imports the invoice"); story.then("the invoice should be saved"); story.then("the invoice total should be 42.50 USD");});import { story } from 'executable-stories-cypress';
it("Import XML invoice", () => { story.init(); story.given("the invoice XML is"); story.code({ label: "Invoice", content: `<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>`, lang: "xml", }); story.when("the user imports the invoice"); story.then("the invoice should be saved"); story.then("the invoice total should be 42.50 USD");});import ( "testing" es "github.com/jagreehal/executable-stories/packages/executable-stories-go")
func TestImportXMLInvoice(t *testing.T) { s := es.Init(t, "Import XML invoice") s.Given("the invoice XML is") s.Code("Invoice", `<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>`, "xml") s.When("the user imports the invoice") s.Then("the invoice should be saved") s.Then("the invoice total should be 42.50 USD")}from executable_stories import story
def test_import_xml_invoice(): story.init("Import XML invoice") story.given("the invoice XML is") story.code("Invoice", """<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>""", lang="xml") story.when("the user imports the invoice") story.then("the invoice should be saved") story.then("the invoice total should be 42.50 USD")use executable_stories::Story;
#[test]fn test_import_xml_invoice() { let mut s = Story::new("Import XML invoice"); s.given("the invoice XML is"); s.code("Invoice", "<invoice>\n <id>INV-100</id>\n <amount>42.50</amount>\n <currency>USD</currency>\n</invoice>", Some("xml")); s.when("the user imports the invoice"); s.then("the invoice should be saved"); s.then("the invoice total should be 42.50 USD");}import dev.executablestories.junit5.Storyimport org.junit.jupiter.api.Test
class InvoiceTest { @Test fun `import xml invoice`() { Story.init("Import XML invoice") Story.given("the invoice XML is") Story.code("Invoice", """ <invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency> </invoice> """.trimIndent(), "xml") Story.`when`("the user imports the invoice") Story.then("the invoice should be saved") Story.then("the invoice total should be 42.50 USD") }}using ExecutableStories.Xunit;using Xunit;
public class InvoiceTests : IDisposable{ [Fact] public void ImportXmlInvoice() { Story.Init("Import XML invoice"); Story.Given("the invoice XML is"); Story.Code("Invoice", @"<invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency></invoice>", "xml"); Story.When("the user imports the invoice"); Story.Then("the invoice should be saved"); Story.Then("the invoice total should be 42.50 USD"); }}What the report renders
Section titled “What the report renders”### ✅ Import XML invoice
- **Given** the invoice XML is **Invoice** ```xml <invoice> <id>INV-100</id> <amount>42.50</amount> <currency>USD</currency> </invoice>- When the user imports the invoice
- Then the invoice should be saved
- And the invoice total should be 42.50 USD