Skip to end of metadata
Go to start of metadata

From a Feature File

Katalon Studio allows you to run the feature file instantly by itself to make sure it works properly. Open the desired Features file, click the Play button on the main toolbar.

In Test Cases

Katalon Studio supports Cucumber keywords along with the original built-in keywords. The user doesn't have to import Cucumber libraries into Katalon Studio.

To include Cucumber Feature file in Katalon Studio test case: 

  1. Execute a single Feature File:
  • Create a New Test Case and use Cucumber built-in keyword "runFeatureFile" as demonstrated example below.
  • Execute the Test Case normal

    CucumberKW.runFeatureFile('Include/features/New Feature File.feature')




    2. Execute multiple Feature Files 
    You can execute multipleFeatureFiles as long as they are within the same 'features' folder using 'runFeatureFolder' built-in keyword. 

    CucumberKW.runFeatureFolder('Include/features/New Feature File.feature')


    3. Execute using Cucumber Runner:

    Using 'runWithCucumberRunner' keyword, you can execute a Feature File with a set of options. Example you've created a Step Definitions called MyCucumberRunner within scripts folder

    CucumberKW.runWithCucumberRunner(MyCucumberRunner.class)
    


    • Example #1: Run all Feature files in Include/features Folder
       import org.junit.runner.RunWith;
       import cucumber.api.CucumberOptions;
       import cucumber.api.junit.Cucumber;
       
       @RunWith(Cucumber.class)
       @CucumberOptions(features = "Include/features", glue = "")
       public class MyCucumberRunner {}
       
    • Example #2: Run all Feature files in a specified file/folder
       import org.junit.runner.RunWith;
       import cucumber.api.CucumberOptions;
       import cucumber.api.junit.Cucumber;
       
       @RunWith(Cucumber.class)
       @CucumberOptions(features = "Your_Folder_Or_File_Path", glue = "")
       public class MyCucumberRunner {}
       
    • Example #3: Run all Feature files in a specified file/folder, generate JUnit Cucumber report with XML pretty format, and copy to a specified folder
       import org.junit.runner.RunWith;
       import cucumber.api.CucumberOptions;
       import cucumber.api.junit.Cucumber;
       @RunWith(Cucumber.class)
       @CucumberOptions(features="Your_Folder_Path", glue="", plugin = ["pretty",
                            "junit:Folder_Name/cucumber.xml"])
       public class MyCucumberRunner {
       }
       
    • Example #4: Run all Feature files in a specified file/folder, generate multi Cucumber reports with XML, JSON, HTML pretty format, and copy to a specified folder
       import org.junit.runner.RunWith;
       import cucumber.api.CucumberOptions;
       import cucumber.api.junit.Cucumber;
       @RunWith(Cucumber.class)
       @CucumberOptions(features="Your_Folder_Path", glue="", plugin = ["pretty",
                            "junit:Folder_Name/cucumber.xml",
                            "html:Folder_Name",
                            "json:Folder_Name/cucumber.json"])
       public class MyCucumberRunner {
       }

       

Cucumber Reports

There is NO custom report for executing Feature File. Katalon Studio uses only generated Cucumber reports for Test Suite/Test Suite Collection execution level, in which the test cases contain the Cucumber Features file. The generated Cucumber report of Test Suite/Test Suite Collection will be located in the same folder of Katalon Studio report's folder:

  • In Katalon Studio Tests Explorer, right-click at the desired Report > Open Containing Folder. Katalon Studio will redirect you to the local folder where Cucumber Reports are stored. 
  • Katalon Studio supports three formats for Cucumber reports: 
    • JSON
    • XML
    • HTML




  • No labels