Git Product home page Git Product logo

Comments (12)

ttutisani avatar ttutisani commented on June 2, 2024

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.

ttutisani avatar ttutisani commented on June 2, 2024

Probably I can take on this task in the nearest future.

from xunit.gherkin.quick.

ttutisani avatar ttutisani commented on June 2, 2024

Work in progress can be observed here: https://github.com/ttutisani/Xunit.Gherkin.Quick/compare/scenarioOutline?expand=1

from xunit.gherkin.quick.

ttutisani avatar ttutisani commented on June 2, 2024

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.

robbiecourtney avatar robbiecourtney commented on June 2, 2024

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.

ttutisani avatar ttutisani commented on June 2, 2024

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

ttutisani avatar ttutisani commented on June 2, 2024

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

ttutisani avatar ttutisani commented on June 2, 2024

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.

robbiecourtney avatar robbiecourtney commented on June 2, 2024

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.

ttutisani avatar ttutisani commented on June 2, 2024

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

ttutisani avatar ttutisani commented on June 2, 2024

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.

ttutisani avatar ttutisani commented on June 2, 2024

All pending action items are complete now.

from xunit.gherkin.quick.

Related Issues (20)

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.