Comments (2)
I agree that "Then" step definitions should have at least one assert. But asserts should be optional for "Given" and "When" step definitions:
- "Given" step definitions defines the testing context : you could use assert to ensure your testing context is coherent (e.g. no negative number of cukes)
- "Then" step definitions define some action to do on the testing context : you could use assert to ensure your testing context is coherent (e.g. number of cukes has been defined)
So the @given "I have {int} cukes in my belly" example should be replaced with a @then step definition to make the issue more coherent.
By the way, it is true that this @given example is not very good as it creates a Belly
but this object instance is automatically deleted by the JVM when the method ends, so it cannot be used in another step definition (the line 8 Belly belly = new Belly();
should be defined as a field to do so).
from cucumber-java-skeleton.
You are looking at an intentionally incomplete project. The When and Then steps are present in the scenario:
And this example project was written using a test driven approach. So just enough code has been written to get the tests running and failing. When run Cucumber will complain about two missing step definitions. You can add those and then incrementally implement the scenario.
This is great for people who are learning TDD, but probably less useful as a minimal working example. Please do feel free to workshop a better but still minimal example.
from cucumber-java-skeleton.
Related Issues (20)
- download and run gradle build fail HOT 5
- different branches for gradle / maven? HOT 2
- Project did not run HOT 10
- Runs fine in gradle; loses step definitions in IntelliJ HOT 3
- gradle version does not work HOT 1
- Upgrade Java Skeleton to V5
- Person class doesn't exist HOT 2
- Help with this Cucumber Scenario?? HOT 7
- How to disable cucumber message in eclipse HOT 1
- Help with this Cucumber Scenario??
- mvn test BUILD SUCCESS instead of FAILURE after adding TestNG HOT 1
- Action Required: Fix Renovate Configuration
- WARNING: You are using deprecated Main class. Please use io.cucumber.core.cli.Main HOT 13
- Help Needed: Cucumber Test with Spring Boot from Executable Jar HOT 1
- Dependency Dashboard
- Failed gradle test task from the skeleton project. HOT 4
- Cucumber multiple tags not supported for the version 7.9.0 using Junit runner HOT 1
- UndefinedStepException HOT 2
- `Step undifined` for demo project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cucumber-java-skeleton.