1"use strict";(self.webpackChunkKatalon_Docs=self.webpackChunkKatalon_Docs||[]).push([[6419],{28453:(e,r,t)=>{t.d(r,{R:()=>a,x:()=>d});var n=t(96540);const s={},i=n.createContext(s);function a(e){const r=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function d(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),n.createElement(i.Provider,{value:r},e.children)}},57629:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>o,contentTitle:()=>d,default:()=>u,frontMatter:()=>a,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-folder-with-tags","title":"[Cucumber] Run Feature Folder with Tags","description":"Katalon Studio supports executing feature files in a folder with the runFeatureFolderWithTags function, using the following tag expressions:","source":"@site/docs/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-folder-with-tags.md","sourceDirName":"keywords/keyword-description-in-katalon-studio/cucumber-keywords","slug":"/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-folder-with-tags","permalink":"/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-folder-with-tags","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedAt":1771921533000,"frontMatter":{"title":"[Cucumber] Run Feature Folder with Tags"},"sidebar":"katalon-studio","previous":{"title":"[Cucumber] Run Feature File","permalink":"/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-file"},"next":{"title":"[Cucumber] Run Feature Folder","permalink":"/katalon-studio/keywords/keyword-description-in-katalon-studio/cucumber-keywords/cucumber-run-feature-folder"}}');var s=t(74848),i=t(28453);const a={title:"[Cucumber] Run Feature Folder with Tags"},d=void 0,o={},l=[{value:"Description",id:"description",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3}];function c(e){const r={a:"a",code:"code",h2:"h2",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)(r.p,{children:["Katalon Studio supports executing feature files in a folder with the ",(0,s.jsx)(r.code,{children:"runFeatureFolderWithTags"})," function, using the following tag expressions:"]}),"\n",(0,s.jsxs)(r.table,{children:[(0,s.jsx)(r.thead,{children:(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.th,{children:(0,s.jsx)(r.strong,{children:"Expression"})}),(0,s.jsx)(r.th,{children:(0,s.jsx)(r.strong,{children:"Description"})})]})}),(0,s.jsxs)(r.tbody,{children:[(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:(0,s.jsx)(r.code,{children:"@tag1 and @tag2"})}),(0,s.jsxs)(r.td,{children:["Features or scenarios tagged with both ",(0,s.jsx)(r.code,{children:"@tag1"})," and ",(0,s.jsx)(r.code,{children:"@tag2"}),"."]})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:(0,s.jsx)(r.code,{children:"@tag1 or @tag2"})}),(0,s.jsxs)(r.td,{children:["Features or scenarios tagged with either ",(0,s.jsx)(r.code,{children:"@tag1"})," or ",(0,s.jsx)(r.code,{children:"@tag2"}),"."]})]})]})]}),"\n",(0,s.jsxs)(r.p,{children:["To learn more about tag expressions, refer to this Cucumber document: ",(0,s.jsx)(r.a,{href:"https://cucumber.io/docs/cucumber/api/#tag-expressions",children:"Cucumber tag expression"}),"."]}),"\n",(0,s.jsx)(r.h2,{id:"description",children:"Description"}),"\n",(0,s.jsx)(r.p,{children:"Query the feature files in the specified folder, and execute the features or scenarios associated with all or any of the input tags."}),"\n",(0,s.jsxs)(r.p,{children:["Keyword name: ",(0,s.jsx)(r.code,{children:"runFeatureFolderWithTags"})]}),"\n",(0,s.jsxs)(r.p,{children:["Keyword syntax: ",(0,s.jsx)(r.code,{children:"runFeatureFolderWithTags(folderRelativePath, tags, cucumberRunOptions, flowControl)"})]}),"\n",(0,s.jsx)(r.h2,{id:"parameters",children:"Parameters"}),"\n",(0,s.jsxs)(r.table,{children:[(0,s.jsx)(r.thead,{children:(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.th,{children:"Parameter"}),(0,s.jsx)(r.th,{children:"Parameter Type"}),(0,s.jsx)(r.th,{children:"Required"}),(0,s.jsx)(r.th,{children:"Description"})]})}),(0,s.jsxs)(r.tbody,{children:[(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"folderRelativePath"}),(0,s.jsx)(r.td,{children:"String"}),(0,s.jsx)(r.td,{children:"Yes"}),(0,s.jsxs)(r.td,{children:["The folder relative path starts from the current project location. To rerun failed scenarios, provide the path to your rerun file prefixed with ",(0,s.jsx)(r.code,{children:"@"})," (e.g., ",(0,s.jsx)(r.code,{children:"@rerun.txt"}),")."]})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"tags"}),(0,s.jsx)(r.td,{children:"String, String[], or String... (Varargs)"}),(0,s.jsx)(r.td,{children:"Yes"}),(0,s.jsx)(r.td,{children:"The tags of the features or scenarios that you want to execute."})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsx)(r.td,{children:"cucumberRunOptions"}),(0,s.jsx)(r.td,{children:"Map"}),(0,s.jsx)(r.td,{children:"No"}),(0,s.jsxs)(r.td,{children:["A map of options to configure the Cucumber execution. Use ",(0,s.jsx)(r.code,{children:"failedTestFilePath"})," to specify a file path where failed scenarios will be saved."]})]}),(0,s.jsxs)(r.tr,{children:[(0,s.jsxs)(r.td,{children:["flowControl (only valid when tags are of ",(0,s.jsx)(r.code,{children:"String[]"})," type)"]}),(0,s.jsx)(r.td,{children:"FailureHandling"}),(0,s.jsx)(r.td,{children:"Optional"}),(0,s.jsxs)(r.td,{children:["Controls the execution flow if the step fails. Specify ",(0,s.jsx)(r.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)(r.h3,{id:"returns",children:"Returns"}),"\n",(0,s.jsxs)(r.p,{children:["An instance of ",(0,s.jsx)(r.code,{children:"CucumberRunnerResult"})," that includes the status of the keyword and report folder location."]}),"\n",(0,s.jsx)(r.h3,{id:"examples",children:"Examples"}),"\n",(0,s.jsxs)(r.p,{children:["Example 1: Using tags of ",(0,s.jsx)(r.code,{children:"String"})," type"]}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-jsx",children:'// With AND expression\nCucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1 and @tag2")\n\n// With OR expression\n```jsx\nCucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1 or @tag2")\n'})}),"\n",(0,s.jsxs)(r.p,{children:["Example 2: Using tag arrays (",(0,s.jsx)(r.code,{children:"String[]"}),")"]}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-jsx",children:'// With AND expression\nString[] logTags = ["@tag1 and @tag2"] as String[]\nCucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", logTags, FailureHandling.STOP_ON_FAILURE)\n\n//With OR expression\nString[] logTags2 = ["@tag1 or @tag2"] as String[]\nCucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", logTags2, FailureHandling.STOP_ON_FAILURE)\n'})}),"\n",(0,s.jsxs)(r.p,{children:["Example 3: Using Varargs (",(0,s.jsx)(r.code,{children:"String..."}),")"]}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-jsx",children:'CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1 and @tag2")\n'})}),"\n",(0,s.jsx)(r.p,{children:"Example 4: Capture and rerun failed scenarios"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-jsx",children:"import
1com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW\nimport com.kms.katalon.core.model.FailureHandling\n\n// Run folder with tags\nCucumberKW.runFeatureFolderWithTags('Include/features', [\"@smoke and not @wip\"] as String[], \n [failedTestFilePath: 'failed-smoke-suite.txt'], FailureHandling.CONTINUE_ON_FAILURE)\n// Rerun failed scenarios from folder execution\nCucumberKW.runFeatureFolder('@failed-all-features.txt', \n [failedTestFilePath: 'failed-all-features-retry.txt'])\n"})})]})}function u(e={}){const{wrapper:r}={...(0,i.R)(),...e.components};return r?(0,s.jsx)(r,{...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.