com.rational.test.ft.script

Annotation Type FTCucumberOptions



  • @Retention(value=RUNTIME)
     @Target(value=TYPE)
    public @interface FTCucumberOptions
    Annotation for making an FT Script integrate with Cucumber. This annotation must be applied to the class. Cucumber options passed must be in the format as it would be passed to Cucumber's CLI. Examples:

    Example 1: These 2 parameters are must.
    --glue: Where glue code (step definitions, hooks and plugins) are loaded from. In this case a blank string ("") as value to glue means, the step definition should be looked for inside all the folders in the Functional Tester project, provided there are no duplicate steps(in which case there is a valid exception).
    The other being the feature file that needs to be run, which sits in a folder named "Features" inside of the FT project
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "Features\\ValidateOrderFeature.feature" })
    Example 2: Providing folder to the feature files
    Run all feature files present in the folder named "Features" inside FT project
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "Features" })
    Example 3: Providing more than one feature file
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "Features\\PlaceOrder.feature", "Features\\ValidateOrder.feature", })
    Example 4: Providing 2 glue(step definition) options.
    In this case, the step definitions are present in two different folder/packages inside the project
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "com.package1", //Folder inside project- com/package1 "--glue", "com.package2", //Folder inside project- com/package2 "Features\\ValidateOrderFeature.feature" })
    Example 5: Print readable output on FT console
    pretty plugin: prints readable information about the run on console
    monochrome: boolean option. Setting to true(having the option here) means that the console output for the Cucumber test are much more readable
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "--plugin", "pretty", "--monochrome", "Features\\ValidateOrderFeature.feature" })
    Example 6: Run specific tagged scenario using --tags options.
    Run only scenarios tagged with @smoke tag
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "--plugin", "pretty", "--monochrome", "--tags", "@smoke", "Features\\ValidateOrderFeature.feature" })
    Example 7: Run using --tags options by ORing of tags
    Run all Scenarios tagged with @smoke or @sanity
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "--plugin", "pretty", "--monochrome", "--tags", "@smoke,@sanity", "Features\\ValidateOrderFeature.feature" })
    Example 8: Run using --tags options by ANDing of tags
    Run all Scenarios tagged with @smoke and @sanity
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "--plugin", "pretty", "--monochrome", "--tags", "@smoke", "--tags", "@sanity", "Features\\ValidateOrderFeature.feature" })
    Example 9: Run using --tags options by using NOT(~) combination
    Run all Scenarios not tagged with @smoke tag
     
    @FTCucumberOptions(cucumberOptions = { "--glue", "", "--plugin", "pretty", "--monochrome", "--tags", "~@smoke", "Features\\ValidateOrderFeature.feature" })
    Example 10: Run using only feature file or folder to feature file(s)
    In this case, mandatory option like "--glue" takes the default value as blank string(""), i.e. look for step definitions in all the folder/package inside FT project.
    In this way, if any other cucumber option like --monochrome etc is provided, it is expected that all the option including the mandatory ones are passed
     
    @FTCucumberOptions(cucumberOptions = { "Features\\ValidateOrderFeature.feature" })
    • Field Summary

      Fields 
      Modifier and Type Fields and Description
      static java.lang.String CUCUMBER_DEFAULT 
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element and Description
      java.lang.String[] cucumberOptions
      this is the methods that takes all the cucumber CLI options, in the same syntax.
    • Field Detail

      • CUCUMBER_DEFAULT

        public static final java.lang.String CUCUMBER_DEFAULT
    • Element Detail

      • cucumberOptions

        public abstract java.lang.String[] cucumberOptions
        this is the methods that takes all the cucumber CLI options, in the same syntax.
        Returns:
        Default:
        "--glue \'\' --plugin pretty --plugin html:CukeLogs --plugin json:CukeLogs/cucumberResult.json --monochrome"