Giter Site home page Giter Site logo

java-cucumber-test-demo's Introduction

Java Cucumber Test Demo

Demo from https://docs.cucumber.io/guides/10-minute-tutorial/

Cucumber是一个BDD测试框架,我们可以在.feature文件中,按特定格式来描述测试用例, 然后在某些Java文件中定义与之相对应的代码,然后利用junit来执行并出报告。

.feature.java之间是怎么对应上的呢?主要是利用了@Given/@When等注解, 以及相应的文字描述(用的是正则匹配字符串),将两者联系在一起。

一个.feature中可以包含多个场景Scenario,一个Stepdefs.java中可以定义多个step。

虽然我们使用了jUnit来运行测试,但是语法并不满足jUnit的定义,所以需要另一个文件来调用 Cucumber.class作为Test runner。这个文件需要以???Test.java结尾,在cucumber中, 一般写成runTest.java,但是也可以写成别的名字,比如RunCucumberTest,只要能让mvn test 找到即可。

mvn test

java-cucumber-test-demo's People

Contributors

freewind 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.