Giter Club home page Giter Club logo

bdd-sample-cucumber-jvm's Introduction

bdd-sample-cucumber-jvm

This is a sample project of cucumber-jvm.
See [Cucumber project page] (http://cukes.info/).

Install Cucumber-jvm

Maven installation

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
	<version>4.10</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>info.cukes</groupId>
	<artifactId>cucumber-java</artifactId>
	<version>1.0.11</version>
</dependency>
<dependency>
	<groupId>info.cukes</groupId>
	<artifactId>cucumber-junit</artifactId>
	<version>1.0.11</version>
</dependency>

Describe Scenario File

Feature: ユーザModels

Scenario: ユーザ名を指定して登録する
    Given   ユーザ名 'tajima'
    When    ユーザを登録する
    Then    ユーザ名のみのオブジェクトが登録されること
        """
        {"name":"tajima","projects":[]}
        """

[sample] (https://github.com/mid0111/bdd-sample-cucumber-jvm/blob/master/src/test/resource/sample/test/UserModels.feature)

[sample described in japanese] (https://github.com/cucumber/cucumber/tree/master/examples/i18n/ja)

Compile Scenario File

  • To run the .feature using a JUnit Runner, create a blank test class.

      package sample.test;
    
      import org.junit.runner.RunWith;
    
      import cucumber.junit.Cucumber;
    
      @RunWith(Cucumber.class)
      @Cucumber.Options(format = { "pretty", "html:target/cucumber" })
      public class RunTests {
    
      }
    
  • Run Junit test, and Take a look at the output in the Console Tab in Eclipse.

      You can implement missing steps with the snippets below:
    
      @Given("^ユーザ名 'tajima'$")
      public void ユーザ名_tajima() throws Throwable {
          // Express the Regexp above with the code you wish you had
          throw new PendingException();
      }
      
      @When("^ユーザを登録する$")
      public void ユーザを登録する() throws Throwable {
          // Express the Regexp above with the code you wish you had
          throw new PendingException();
      }
      
      @Then("^ユーザ名のみのオブジェクトが登録されること$")
      public void ユーザ名のみのオブジェクトが登録されること(String arg1) throws Throwable {
          // Express the Regexp above with the code you wish you had
          throw new PendingException();
      }
    

Describe code

JUnit

![image] (https://github.com/mid0111/bdd-sample-cucumber-jvm/blob/master/readme/Cucumber-Junit.png?raw=true)

HTML Report

![image2] (https://github.com/mid0111/bdd-sample-cucumber-jvm/blob/master/readme/Cucumber-report.png?raw=true)

TODO [jenkins-cucumber-jvm-reports-plugin] (https://github.com/masterthought/jenkins-cucumber-jvm-reports-plugin)

bdd-sample-cucumber-jvm's People

Contributors

mid0111 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.