Book Image

Cucumber Cookbook

By : Shankar Garg
Book Image

Cucumber Cookbook

By: Shankar Garg

Overview of this book

Table of Contents (13 chapters)
Cucumber Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring the naming conventions


As Cucumber can be implemented in multiple languages, developers with multiple language knowledge and background can work on the same project. So, sometimes it might be difficult for teams to manage the naming conventions, such as underscore or camel case.

Cucumber lets the team choose the naming convention. Depending on the naming convention, Cucumber generates the method names for Step Definitions. Let's see how it can be done in the next section.

How to do it…

  1. If you want to use camel case, then add the following code to @CucumberOptions:

    snippets=SnippetType.CAMELCASE
  2. If you want to use underscore, then add the following code to @CucumberOptions.

    snippets=SnippetType.UNDERSCORE
  3. This is what the code for RunCukeTest.Java looks like:

    package com.CucumberOptions;
    
    import org.junit.runner.RunWith;
    import Cucumber.api.CucumberOptions;
    import Cucumber.api.SnippetType;
    import Cucumber.api.junit.Cucumber;
    
    @RunWith(Cucumber.class)
    @CucumberOptions(  
        Features ...