1"use strict";(self.webpackChunkKatalon_Docs=self.webpackChunkKatalon_Docs||[]).push([[6155],{28453:(e,t,r)=>{r.d(t,{R:()=>a,x:()=>l});var n=r(96540);const s={},i=n.createContext(s);function a(e){const t=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),n.createElement(i.Provider,{value:t},e.children)}},84396:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>n,toc:()=>o});const n=JSON.parse('{"id":"keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-file-with-tags","title":"[Cucumber] Run Feature File with Tags","description":"Katalon Studio supports executing a single feature file with the runFeatureFileWithTags function, using the following tag expressions:","source":"@site/docs/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-file-with-tags.md","sourceDirName":"keywords/keyword-description-in-katalon-studio/cucumber-keywords","slug":"/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-file-with-tags","permalink":"/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-file-with-tags","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedAt":1771921533000,"frontMatter":{"title":"[Cucumber] Run Feature File with Tags"},"sidebar":"katalon-studio","previous":{"title":"[LLM] Assert Text","permalink":"/katalon-studio/keywords/keyword-description-in-katalon-studio/ai-keywords/llm-assert-text"},"next":{"title":"[Cucumber] Run Feature File","permalink":"/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-file"}}');var s=r(74848),i=r(28453);const a={title:"[Cucumber] Run Feature File with Tags"},l=void 0,d={},o=[{value:"Description",id:"description",level:3},{value:"Parameters",id:"parameters",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3}];function c(e){const t={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["Katalon Studio supports executing a single feature file with the ",(0,s.jsx)(t.code,{children:"runFeatureFileWithTags"})," function, using the following tag expressions:"]}),"\n",(0,s.jsxs)(t.table,{children:[(0,s.jsx)(t.thead,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.th,{children:(0,s.jsx)(t.strong,{children:"Expression"})}),(0,s.jsx)(t.th,{children:(0,s.jsx)(t.strong,{children:"Description"})})]})}),(0,s.jsxs)(t.tbody,{children:[(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.code,{children:"@tag1 and @tag2"})}),(0,s.jsxs)(t.td,{children:["Features or scenarios tagged with both ",(0,s.jsx)(t.code,{children:"@tag1"})," and ",(0,s.jsx)(t.code,{children:"@tag2"}),"."]})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.code,{children:"@tag1 or @tag2"})}),(0,s.jsxs)(t.td,{children:["Features or scenarios tagged with either ",(0,s.jsx)(t.code,{children:"@tag1"})," or ",(0,s.jsx)(t.code,{children:"@tag2"}),"."]})]})]})]}),"\n",(0,s.jsxs)(t.p,{children:["To learn more about tag expressions, refer to this Cucumber document: ",(0,s.jsx)(t.a,{href:"https://cucumber.io/docs/cucumber/api/#tag-expressions",children:"Cucumber tag expression"}),"."]}),"\n",(0,s.jsx)(t.h3,{id:"description",children:"Description"}),"\n",(0,s.jsx)(t.p,{children:"Execute the features or scenarios associated with all or any the input tags."}),"\n",(0,s.jsxs)(t.p,{children:["Keyword name: ",(0,s.jsx)(t.code,{children:"runFeatureFileWithTags"})]}),"\n",(0,s.jsxs)(t.p,{children:["Keyword syntax: ",(0,s.jsx)(t.code,{children:"runFeatureFileWithTags(relativeFilePath, tags, cucumberRunOptions, flowControl)"})]}),"\n",(0,s.jsx)(t.h3,{id:"parameters",children:"Parameters"}),"\n",(0,s.jsxs)(t.table,{children:[(0,s.jsx)(t.thead,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.th,{children:"Parameter"}),(0,s.jsx)(t.th,{children:"Parameter Type"}),(0,s.jsx)(t.th,{children:"Required"}),(0,s.jsx)(t.th,{children:"Description"})]})}),(0,s.jsxs)(t.tbody,{children:[(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:"relativeFilePath"}),(0,s.jsx)(t.td,{children:"String"}),(0,s.jsx)(t.td,{children:"Yes"}),(0,s.jsxs)(t.td,{children:["The relative path to the feature file that starts from the current project location. To rerun failed scenarios, provide the path to your rerun file prefixed with ",(0,s.jsx)(t.code,{children:"@"})," (e.g., ",(0,s.jsx)(t.code,{children:"@rerun.txt"}),")."]})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:"tags"}),(0,s.jsx)(t.td,{children:"String, String[], or String... (Varargs)"}),(0,s.jsx)(t.td,{children:"Yes"}),(0,s.jsx)(t.td,{children:"The tags of the features or scenarios that you want to execute."})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:"cucumberRunOptions"}),(0,s.jsx)(t.td,{children:"Map"}),(0,s.jsx)(t.td,{children:"No"}),(0,s.jsxs)(t.td,{children:["A map of options to configure the Cucumber execution. Use ",(0,s.jsx)(t.code,{children:"failedTestFilePath"})," to specify a file path where failed scenarios will be saved."]})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsxs)(t.td,{children:["flowControl (only valid when tags are of ",(0,s.jsx)(t.code,{children:"String[]"})," type)"]}),(0,s.jsx)(t.td,{children:"FailureHandling"}),(0,s.jsx)(t.td,{children:"Optional"}),(0,s.jsxs)(t.td,{children:["Controls the execution flow if the step fails. Specify ",(0,s.jsx)(t.a,{href:"/katalon-studio/maintain-tests/configure-failure-handling-settings-in-katalon-studio",children:"failure handling"})," schema to determine whether the execution should be allowed to continue or stop."]})]})]})]}),"\n",(0,s.jsx)(t.h3,{id:"returns",children:"Returns"}),"\n",(0,s.jsxs)(t.p,{children:["An instance of ",(0,s.jsx)(t.code,{children:"CucumberRunnerResult"})," that includes the status of the keyword and report folder location."]}),"\n",(0,s.jsx)(t.h3,{id:"examples",children:"Examples"}),"\n",(0,s.jsxs)(t.p,{children:["Example 1: Using tags of ",(0,s.jsx)(t.code,{children:"String"})," type"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-jsx",children:'// With AND expression\nCucumberKW.runFeatureFileWithTags("Include/features/New Feature File.feature", "@tag1 and @tag2")\n// With OR expression\nCucumberKW.runFeatureFileWithTags("Include/features/New Feature File.feature", "@tag1 or @tag2")\n'})}),"\n",(0,s.jsxs)(t.p,{children:["Example 2: Using tag arrays (",(0,s.jsx)(t.code,{children:"String[]"}),")"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-jsx",children:'// With AND expression\nString[] logTags = ["@tag1 and @tag2"] as String[]\nCucumberKW.runFeatureFileWithTags("Include/features/New Feature File.feature", logTags, FailureHandling.STOP_ON_FAILURE)\n// With OR expression\nString[] logTags = ["@tag1 or @tag2"] as String[]\nCucumberKW.runFeatureFileWithTags("Include/features/New Feature File.feature", logTags, FailureHandling.STOP_ON_FAILURE)\n'})}),"\n",(0,s.jsxs)(t.p,{children:["Example 3: Using Varargs (",(0,s.jsx)(t.code,{children:"String..."}),")"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-jsx",children:'CucumberKW.runFeatureFileWithTags("Include/features/New Feature File.feature", "@tag1 and @tag2")\n'})}),"\n",(0,s.jsx)(t.p,{children:"Example 4: Capture and rerun failed scenarios"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-jsx",children:"// Run tests and generate rerun file with failed scenarios\nCucumberKW.runFeatureFileWithTags('Include/features/MyFeature.feature', ['@smoke'] as String[], \n [failedTestFilePath: 'failed-smoke.txt'], FailureHandling.CONTINUE_ON_FAILURE)\n// Rerun failed smoke tests\nCucumberKW.runFeatureFileWithTags('@failed-smoke.txt', \n ['@smoke'] as String[], \n [failedTestFilePath: 'failed-smoke-retry.txt'])\n"})})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.