Comments (12)
The more I think about this topic, the more complexity is revealed.
Since the Scenario Outline is going to run for each row of the examples, I think it will make sense if during the discovery each row is listed as a separate test case (Theory in Xunit).
That way, here are the benefits:
- Each test case can be executed separately.
- Each one will report pass/failure status separately.
So it seems that discovery code should change too.
from xunit.gherkin.quick.
Probably I can take on this task in the nearest future.
from xunit.gherkin.quick.
Work in progress can be observed here: https://github.com/ttutisani/Xunit.Gherkin.Quick/compare/scenarioOutline?expand=1
from xunit.gherkin.quick.
Coding is done. Need to release a new version of Nuget.
I might as well include another change too (for output property to be hidden from derived classes), since anyway this is a backwards incompatible release).
from xunit.gherkin.quick.
Hi,
I'm trying to create the Scenario Outline below.
`Feature: Pricing
Scenario Outline: Discounts
Given items like <items> costing <price> in John's cart
And a <discount> discount
When John proceeds to checkout
Then he should only pay <final> for the items in his cart
Examples: Daily deals
Daily deals are always 17% discounts.
| items | price | discount | final |
| "Writing Great Specifications" | $44.99 | 17% | $37.34 |
Examples: Coupons
There are five different types of coupons available.
| items | price | discount | final |
| "Writing Great Specifications" | $44.99 | 5% | $42.74 |
| "Writing Great Specifications" | $44.99 | 15% | $38.24 |
| "Writing Great Specifications" | $44.99 | 30% | $31.49 |
| "Writing Great Specifications" | $44.99 | 50% | $22.49 |
| "Writing Great Specifications" | $44.99 | 75% | $11.24 |
Examples: Bundles
We offer "buy two, pay for one" bundles.
| items | price | discount | final |
| "Specification by Example" bundle | $44.99 | 50% | $22.49 |`
I'm running into the following issues:
- Error: Examples table did not provide value for 'items> costing <price'. This is from the Given.
- Issues with decimals. I couldn't get 44.99 to work. I had to make all of the numbers whole numbers to get a test to pass. Same thing with the %.
I would love to see support for this type of Scenario Outline.
Thanks.
from xunit.gherkin.quick.
@robbiecourtney Can you please also provide the code for the feature class? At least empty methods for steps.
Now, about those 2 items that you mentioned:
- First error - I suspect is because I never tried to put 2 placeholders in the same step. I will try that today and see. That must be the issue most likely.
- Issues with decimals. I need to see your step method attributes. Remember that step attributes (Given/When/Then etc) take regex pattern. So, in order to match decimal like 44.99, you would need to mention it in the regex like this
[Given("costing ([\d\.]+) in John's cart")]
. This should grab the decimal. Again, this is c# regex syntax.
from xunit.gherkin.quick.
@robbiecourtney also, I think you are using the code from github and not the nuget, correct? just to make sure. Because scenario outline is not yet released in nuget. It will be part of 3.0.0. Current latest release is 2.1.0.
from xunit.gherkin.quick.
All right. @robbiecourtney good news.
I fixed the defective code. You should be good now.
Problem was, as I suspected, it didn't support multiple placeholders in a single step of the outline.
Also, as a proof of concept, and as a help to you, I implemented your feature in the simplest way possible. Have a look at: https://github.com/ttutisani/Xunit.Gherkin.Quick/blob/master/source/Xunit.Gherkin.Quick.ProjectConsumer/Discounts/Discounts.cs
It handles all steps of the outline.
Catch was the regex. Remember that the steps use regex syntax. If you don't fully match the step text with the regex, then it won't work.
from xunit.gherkin.quick.
Awesome! Thank you! Iām not at work now but Iām certain that my regex was wrong. To answer your questions. I downloaded the code this morning so I could try out the Scenario Outline feature. I will get latest in the morning and try out your update. I plan to switch over to the nuget package when you release 3.0. I wanted to use the new feature because I am planning to use it in a presentation to my team next week. Thanks again for working on this!
from xunit.gherkin.quick.
@robbiecourtney no worries. Let me know if you find any other issues. I'll be happy to address them.
That helps release bug-free nuget, so I appreciate your feedback!
from xunit.gherkin.quick.
Nuget package version 3.0.0 is out. After indexing (nuget.org internal process) it should be available for download.
I'm keeping this issue open until I upload the domain model diagram for development reference.
from xunit.gherkin.quick.
All pending action items are complete now.
from xunit.gherkin.quick.
Related Issues (20)
- Prolems with Xunit.DependencyInjection HOT 2
- Scenario outlines don't push values into Data Table objects HOT 3
- Async void step methods always pass HOT 5
- Tests not found after xunit gherkin implementation HOT 2
- Need F# Xunit.Gherkin.Quick example HOT 2
- Fail to discover feature file if tab character is in between "And" keyword and step definition HOT 1
- Has anyone got it work in a Unity3d project? - HelpWanted HOT 14
- Pass string as list HOT 3
- Enable cucumber expressions HOT 14
- Code generator to convert Gherkin file into C# test code?
- Cannot install Xunit.Gherkin.Quick due to circular reference HOT 1
- Double are converted to integers HOT 4
- Running Feature files without compilation HOT 4
- Feature discoverable by pattern parent folder issue HOT 15
- Scenario name in spec constructor HOT 2
- Can we have an @retry attribute? HOT 8
- Exception during discovery
- Feature files not discovered by test explorer in Visual Studio v. 17.6.2 HOT 3
- Add support for more languages HOT 20
- is there a way to go to step definition directly from feature file? HOT 5
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 xunit.gherkin.quick.