[{"data":1,"prerenderedAt":570},["ShallowReactive",2],{"docs-/docs/patterns/variables":3},{"id":4,"title":5,"body":6,"description":562,"extension":563,"meta":564,"navigation":565,"path":566,"seo":567,"stem":568,"__hash__":569},"docs/docs/patterns/variables.md","Variables",{"type":7,"value":8,"toc":553},"minimark",[9,13,22,51,56,170,175,181,250,253,268,271,294,298,308,362,382,386,463,467,517,524,528,549],[10,11,5],"h1",{"id":12},"variables",[14,15,16,17,21],"p",{},"Use ",[18,19,20],"code",{},"{{variable_name}}"," in any step — strings, tables, request bodies. Values are substituted automatically at runtime.",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-gherkin shiki shiki-themes github-light github-dark","When I store the value \"John Doe\" into \"user_name\" variable\nWhen the user enters \"{{user_name}}\" into the \"name\" field\nThen the value of the \"name\" field should be \"{{user_name}}\"\n","gherkin","",[18,30,31,39,45],{"__ignoreMap":28},[32,33,36],"span",{"class":34,"line":35},"line",1,[32,37,38],{},"When I store the value \"John Doe\" into \"user_name\" variable\n",[32,40,42],{"class":34,"line":41},2,[32,43,44],{},"When the user enters \"{{user_name}}\" into the \"name\" field\n",[32,46,48],{"class":34,"line":47},3,[32,49,50],{},"Then the value of the \"name\" field should be \"{{user_name}}\"\n",[52,53,55],"h2",{"id":54},"variable-types","Variable types",[57,58,59,75],"table",{},[60,61,62],"thead",{},[63,64,65,69,72],"tr",{},[66,67,68],"th",{},"Type",[66,70,71],{},"Store",[66,73,74],{},"Use",[76,77,78,98,120,135,150],"tbody",{},[63,79,80,87,92],{},[81,82,83],"td",{},[84,85,86],"strong",{},"Scenario",[81,88,89],{},[18,90,91],{},"I store the value \"...\" into \"name\" variable",[81,93,94,97],{},[18,95,96],{},"{{name}}"," — cleared after the scenario",[63,99,100,105,111],{},[81,101,102],{},[84,103,104],{},"Environment",[81,106,107,108],{},"Defined in ",[18,109,110],{},"testflowkit.yml",[81,112,113,116,117],{},[18,114,115],{},"{{ env.api_key }}",", ",[18,118,119],{},"{{ env.database.host }}",[63,121,122,127,132],{},[81,123,124],{},[84,125,126],{},"Response path",[81,128,129],{},[18,130,131],{},"I store the response path \"data.id\" from the response into \"user_id\" variable",[81,133,134],{},"JSON (GJSON) or XML (XPath)",[63,136,137,142,147],{},[81,138,139],{},[84,140,141],{},"Page element",[81,143,144],{},[18,145,146],{},"I store the content of \"page_title\" into \"title\" variable",[81,148,149],{},"Text from a UI element",[63,151,152,157,162],{},[81,153,154],{},[84,155,156],{},"Random data",[81,158,159],{},[18,160,161],{},"I store the value \"{{ rand:uuid }}\" into \"id\" variable",[81,163,164,165],{},"See ",[166,167,169],"a",{"href":168},"/docs/patterns/random-data","Random Data",[171,172,174],"h3",{"id":173},"environment-variables","Environment variables",[14,176,177,178,180],{},"Define in ",[18,179,110],{},":",[23,182,186],{"className":183,"code":184,"language":185,"meta":28,"style":28},"language-yaml shiki shiki-themes github-light github-dark","env:\n  api_key: \"your-api-key\"\n  base_url: \"https://api.example.com\"\n  database:\n    host: \"localhost\"\n    port: \"5432\"\n","yaml",[18,187,188,198,210,220,228,239],{"__ignoreMap":28},[32,189,190,194],{"class":34,"line":35},[32,191,193],{"class":192},"s9eBZ","env",[32,195,197],{"class":196},"sVt8B",":\n",[32,199,200,203,206],{"class":34,"line":41},[32,201,202],{"class":192},"  api_key",[32,204,205],{"class":196},": ",[32,207,209],{"class":208},"sZZnC","\"your-api-key\"\n",[32,211,212,215,217],{"class":34,"line":47},[32,213,214],{"class":192},"  base_url",[32,216,205],{"class":196},[32,218,219],{"class":208},"\"https://api.example.com\"\n",[32,221,223,226],{"class":34,"line":222},4,[32,224,225],{"class":192},"  database",[32,227,197],{"class":196},[32,229,231,234,236],{"class":34,"line":230},5,[32,232,233],{"class":192},"    host",[32,235,205],{"class":196},[32,237,238],{"class":208},"\"localhost\"\n",[32,240,242,245,247],{"class":34,"line":241},6,[32,243,244],{"class":192},"    port",[32,246,205],{"class":196},[32,248,249],{"class":208},"\"5432\"\n",[14,251,252],{},"Use in Gherkin with dot notation for nested values:",[23,254,256],{"className":25,"code":255,"language":27,"meta":28,"style":28},"Given the user goes to \"{{ env.base_url }}\"\nAnd I set the header \"Authorization\" to \"Bearer {{ env.api_key }}\"\n",[18,257,258,263],{"__ignoreMap":28},[32,259,260],{"class":34,"line":35},[32,261,262],{},"Given the user goes to \"{{ env.base_url }}\"\n",[32,264,265],{"class":34,"line":41},[32,266,267],{},"And I set the header \"Authorization\" to \"Bearer {{ env.api_key }}\"\n",[14,269,270],{},"Load environment-specific files at runtime:",[23,272,276],{"className":273,"code":274,"language":275,"meta":28,"style":28},"language-bash shiki shiki-themes github-light github-dark","tkit run --env-file .env.staging.yml\n","bash",[18,277,278],{"__ignoreMap":28},[32,279,280,284,287,291],{"class":34,"line":35},[32,281,283],{"class":282},"sScJk","tkit",[32,285,286],{"class":208}," run",[32,288,290],{"class":289},"sj4cs"," --env-file",[32,292,293],{"class":208}," .env.staging.yml\n",[171,295,297],{"id":296},"response-paths","Response paths",[14,299,300,301,307],{},"JSON responses use ",[166,302,306],{"href":303,"rel":304},"https://github.com/tidwall/gjson",[305],"nofollow","GJSON"," syntax. XML responses use XPath.",[57,309,310,320],{},[60,311,312],{},[63,313,314,317],{},[66,315,316],{},"Expression",[66,318,319],{},"Example",[76,321,322,332,342,352],{},[63,323,324,329],{},[81,325,326],{},[18,327,328],{},"user.email",[81,330,331],{},"Nested field",[63,333,334,339],{},[81,335,336],{},[18,337,338],{},"items.0",[81,340,341],{},"First array item",[63,343,344,349],{},[81,345,346],{},[18,347,348],{},"items.#",[81,350,351],{},"Array length",[63,353,354,359],{},[81,355,356],{},[18,357,358],{},"//user/id",[81,360,361],{},"XML element (XPath)",[23,363,365],{"className":25,"code":364,"language":27,"meta":28,"style":28},"When I send the request\nAnd I store the response path \"data.id\" from the response into \"user_id\" variable\nAnd I store the response path \"data.name\" from the response into \"user_name\" variable\n",[18,366,367,372,377],{"__ignoreMap":28},[32,368,369],{"class":34,"line":35},[32,370,371],{},"When I send the request\n",[32,373,374],{"class":34,"line":41},[32,375,376],{},"And I store the response path \"data.id\" from the response into \"user_id\" variable\n",[32,378,379],{"class":34,"line":47},[32,380,381],{},"And I store the response path \"data.name\" from the response into \"user_name\" variable\n",[52,383,385],{"id":384},"api-ui-flow","API → UI flow",[23,387,389],{"className":25,"code":388,"language":27,"meta":28,"style":28},"Scenario: Create user via API and verify in UI\n  Given I prepare a request to \"my_api.create_user\"\n  And I set the request body to:\n    \"\"\"\n    { \"name\": \"Test User\", \"email\": \"test@example.com\" }\n    \"\"\"\n  When I send the request\n  And I store the response path \"data.id\" from the response into \"user_id\" variable\n  Then the response status code should be 201\n\n  Given the user goes to the \"users\" page\n  When the user enters \"{{user_id}}\" into the \"search\" field\n  Then the \"user_row\" should contain the text \"Test User\"\n",[18,390,391,396,401,406,411,416,420,426,432,438,445,451,457],{"__ignoreMap":28},[32,392,393],{"class":34,"line":35},[32,394,395],{},"Scenario: Create user via API and verify in UI\n",[32,397,398],{"class":34,"line":41},[32,399,400],{},"  Given I prepare a request to \"my_api.create_user\"\n",[32,402,403],{"class":34,"line":47},[32,404,405],{},"  And I set the request body to:\n",[32,407,408],{"class":34,"line":222},[32,409,410],{},"    \"\"\"\n",[32,412,413],{"class":34,"line":230},[32,414,415],{},"    { \"name\": \"Test User\", \"email\": \"test@example.com\" }\n",[32,417,418],{"class":34,"line":241},[32,419,410],{},[32,421,423],{"class":34,"line":422},7,[32,424,425],{},"  When I send the request\n",[32,427,429],{"class":34,"line":428},8,[32,430,431],{},"  And I store the response path \"data.id\" from the response into \"user_id\" variable\n",[32,433,435],{"class":34,"line":434},9,[32,436,437],{},"  Then the response status code should be 201\n",[32,439,441],{"class":34,"line":440},10,[32,442,444],{"emptyLinePlaceholder":443},true,"\n",[32,446,448],{"class":34,"line":447},11,[32,449,450],{},"  Given the user goes to the \"users\" page\n",[32,452,454],{"class":34,"line":453},12,[32,455,456],{},"  When the user enters \"{{user_id}}\" into the \"search\" field\n",[32,458,460],{"class":34,"line":459},13,[32,461,462],{},"  Then the \"user_row\" should contain the text \"Test User\"\n",[52,464,466],{"id":465},"scope","Scope",[57,468,469,478],{},[60,470,471],{},[63,472,473,476],{},[66,474,475],{},"Variable",[66,477,466],{},[76,479,480,491,502],{},[63,481,482,488],{},[81,483,484,485,487],{},"Scenario (",[18,486,96],{},")",[81,489,490],{},"Current scenario only",[63,492,493,499],{},[81,494,495,496,487],{},"Environment (",[18,497,498],{},"{{ env.* }}",[81,500,501],{},"All scenarios, loaded at startup",[63,503,504,510],{},[81,505,506,507,509],{},"Global (",[18,508,96],{}," set in hooks)",[81,511,512,513],{},"All scenarios — see ",[166,514,516],{"href":515},"/docs/patterns/global-hooks","Global Hooks",[518,519,521],"alert",{"type":520},"warning",[14,522,523],{},"Scenario variables do not persist across scenarios. Use global hooks when you need to share data between scenarios.",[52,525,527],{"id":526},"next-steps","Next Steps",[529,530,531,537,544],"ul",{},[532,533,534,536],"li",{},[166,535,169],{"href":168}," — Generate UUIDs, emails, dates inline",[532,538,539,543],{},[166,540,542],{"href":541},"/docs/patterns/macros","Macros"," — Reusable parameterized steps",[532,545,546,548],{},[166,547,516],{"href":515}," — Cross-scenario setup and teardown",[550,551,552],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s9eBZ, html code.shiki .s9eBZ{--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":28,"searchDepth":41,"depth":41,"links":554},[555,559,560,561],{"id":54,"depth":41,"text":55,"children":556},[557,558],{"id":173,"depth":47,"text":174},{"id":296,"depth":47,"text":297},{"id":384,"depth":41,"text":385},{"id":465,"depth":41,"text":466},{"id":526,"depth":41,"text":527},"Store and reuse dynamic data throughout your test scenarios","md",{},{"title":5},"/docs/patterns/variables",{"title":5,"description":562},"docs/patterns/variables","o5_xnAFtdIKa5OLlyYyQ5cONe7AYN0--yCOxLJ7jE04",1781768344679]