Comments (3)
I will try and play with some options to give you a better answer, but for right this second you seem to be using a mixture of the DSL and feature files. I really recommend only using one. Your current code isn't quite supported as is.
If you're going to use the DSL, you don't need to use the Given/When/Then methods that take a string or regex, for example
Feature("Delete an image") {
Scenario("Delete an image locally") {
Given(the: userHasALocallyStoredImage())
When(the: imageIsDeleted())
Then(the: localStoreShouldBeEmpty())
}
}
func userHasALocallyStoredImage() { XCTFail("Implement the step") }
func imageIsDeleted() { XCTFail("Implement the step") }
func localStoreShouldBeEmpty { XCTFail("Implement the step") }
If you're going with .feature
files, I don't recommend wrapping your steps in the Feature/Scenario DSL. So instead do:
func steps() {
Given("the user has a local stored image" as CucumberExpression) { _, _ in }
When("he delete the image" as CucumberExpression) { _, _ in }
Then("the local store should be empty" as CucumberExpression) { _, _ in }
}
It's possible that some of what you're seeing with all those duplicate entries is really a byproduct of mixing and matching the 2 methods of executing Gherkin.
That said, I am sadly very limited here. Apple doesn't really give access to this in a sane way. The only way CucumberSwift is able to show up in that navigator at all is to use the Objective-C runtime to dynamically create classes. The |
character was used to delineate between features and scenarios in those test case names. I'll leave this issue open so I can explore a bit and see if we can do better.
from cucumberswift.
@Tyler-Keith-Thompson thank you for this nice answer.
But both ways look for me not so "sexy" at the moment.
Why I think so. I like to see a one to one relation for the .feature to the source code. But in both ways something is missing like the Feature / Scenario or the Given/When/Then description text.
One other point I find out is, that I can't start a Scenario separate.
What do you think if a Scenario is warp inside a func test_... so Xcode can find this a test run it and can show it automatic in the navigator. For this case for me its fine only to see the scenario is failed and being inspect the detail I see there its fails.
I try the first way, but for it not really work. CucumberSwift says's alway not implementation for my feature.
Will it be a problem if I stay by my code?
from cucumberswift.
I comment the duplicate code out. But it not looking nice.
// swiftlint:disable todo
// TODO: - Feature("Delete an image")
// MARK: - Scenario("Delete an image locally")
Given("the user has selected an image to save" as CucumberExpression) { _, _ in
...
}
When("the image is saved to the selected location on the device's storage" as CucumberExpression) { _, _ in
...
}
Then("the image becomes persistent on the phone" as CucumberExpression) { _, _ in
...
}
This looks like this in Xcode
from cucumberswift.
Related Issues (20)
- Add a screenshot to scenario in AfterScenario HOT 1
- Call another step from current HOT 2
- "Given something #comment" vs "Given the color is #123456" HOT 4
- Stub generation uses deprecated Matcher initializer HOT 1
- Couldn't execute tests/run project - x86_64-apple-macos vs arm64-apple-macos issue HOT 3
- Quoted string works incorrect in scenario outline when there is a parameter HOT 6
- Group steps per scenario in test report HOT 2
- CucumberTest no longer discovered by Xcode HOT 2
- Some tests are not passing because generated code is localised.
- Wrong order of hooks execution. HOT 1
- Usage of symbols < and > in data table produce errors in non Outline Scenarios. HOT 6
- Broken Gherkin language support due to 951bdd3a48900e24d528f0ac65814e2a06dbfdb5 HOT 2
- Empty cell in table error HOT 3
- Steps are reported as passing although the step definition's closure is XCTFail HOT 6
- Scenarios are running 2 times HOT 8
- @ in steps causes error HOT 2
- Couldn't load project from derived data HOT 7
- Compiled module was created by a different version of the compiler
- Error if comment is placed after tag HOT 1
- No GenerateStepStubsIfNecessary in the report navigator HOT 1
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 cucumberswift.