Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gherkin and add ability to work with multiple languages #128

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
appveyor.yml eol=lf
.gitattributes eol=lf
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check if these changes are necessary.

16 changes: 16 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 1.0.{build}

build_script:
- cmd: >-
dotnet build --configuration Release source\Xunit.Gherkin.Quick.sln

dotnet pack --nologo --no-build --configuration Release source\Xunit.Gherkin.Quick.sln

test_script:
- cmd: >-
dotnet test --nologo --no-restore --configuration Release source\Xunit.Gherkin.Quick.UnitTests\Xunit.Gherkin.Quick.UnitTests.csproj

dotnet test --nologo --no-restore --configuration Release source\Xunit.Gherkin.Quick.ProjectConsumer\Xunit.Gherkin.Quick.ProjectConsumer.csproj
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. How is this different from what the appveyor does by default?




Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
namespace Xunit.Gherkin.Quick.ProjectConsumer.Addition
namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./Addition_ForMultipleUseCases/AddTwoNumbers.em.feature")]
public class AddTwoNumbers : Addition.AddTwoNumbers { }
}

namespace Xunit.Gherkin.Quick.ProjectConsumer.Addition
{

[FeatureFile("./Addition_ForMultipleUseCases/AddTwoNumbers.feature")]
public sealed partial class AddTwoNumbers : Feature
public partial class AddTwoNumbers : Feature
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why partial?

{

private readonly Calculator _calculator = new Calculator();

[Given(@"I chose (-?\d+) as first number")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

# language: em

📚: AddTwoNumbers
In order to learn Math
As a regular human
I want to add two numbers using Calculator

@addition
📕: Add two numbers
😐 I chose 12 as first number
😂 I chose 15 as second number
🎬 I press add
🙏 the result should be 27 on the screen

@addition @bigaddition
📕: Add two bigger numbers
😐 I chose 120 as first number
😂 I chose 150 as second number
🎬 I press add
🙏 the result should be 270 on the screen


📕: Add various pairs of numbers
😐 following table of 4 inputs and outputs:
| Number 1 | Number 2 | Result |
| 1 | 1 | 2 |
| 10 | 20 | 30 |
| 10 | 11 | 21 |
| 111 | 222 | 333 |


📖: Add two numbers with examples
😐 I chose <a> as first number
😂 I chose <b> as second number
🎬 I press add
🙏 the result should be <sum> on the screen

@addition
📓:
| a | b | sum |
| 0 | 1 | 1 |
| 1 | 9 | 10 |

📓: of bigger numbers
| a | b | sum |
| 99 | 1 | 100 |
| 100 | 200 | 300 |

@bigaddition
📓: of large numbers
| a | b | sum |
| 999 | 1 | 1000 |
| 9999 | 1 | 10000 |

@ignore
📓: of floating point numbers
| a | b | sum |
| 1.1 | 2.2 | 3.3 |

@ignore
📕: Add floating point numbers
😐 I chose 1.11 as first number
😂 I chose 2.22 as second number
🎬 I press add
🙏 the result should be 3.33 on the screen

📕: Add numbers after seeing result
😐 I chose 1 as first number
😂 I chose 2 as second number
😂 I pressed add
😂 I saw 3 on the screen
🎬 I choose 4 as first number
😂 I choose 5 as second number
😂 I press add
🙏 the result should be 9 on the screen
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
using System.Threading.Tasks;

namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./Async/AddTwoNumbersAsync.em.feature")]
public class AddTwoNumbersAsync : Addition.Async.AddTwoNumbersAsync { }
}

namespace Xunit.Gherkin.Quick.ProjectConsumer.Addition.Async
{
[FeatureFile("./Async/AddTwoNumbersAsync.feature")]
public sealed class AddTwoNumbersAsync : Feature
public class AddTwoNumbersAsync : Feature
{
private readonly AsyncCalculator _calculator = new AsyncCalculator();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# language: em

📚: AddTwoNumbers Async
In order to learn Math
As a regular human
I want to add two numbers using Calculator Asynchronously

📕: Add two numbers
😐 I chose 12 as first number
😂 I chose 15 as second number
🎬 I press add
🙏 the result should be 27 on the screen
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
using System;
using Xunit.Abstractions;

namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./BeforeAfterHooks/BeforeAfter.em.feature")]
public class BeforeAfter : BeforeAfterHooks.BeforeAfter
{

public BeforeAfter(ITestOutputHelper helper) : base(helper){ }

}
}

namespace Xunit.Gherkin.Quick.ProjectConsumer.BeforeAfterHooks
{
[FeatureFile("./BeforeAfterHooks/BeforeAfter.feature")]
public sealed class BeforeAfter : Feature, IDisposable
public class BeforeAfter : Feature, IDisposable
{
private readonly ITestOutputHelper _testOutputHelper;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# language: em

📚: Before/After Hooks
As a BDD developer using Xunit.Gherkin.Quick
I want to ensure that Before and After hooks work for Scenario
So that I can write code that executes either before or after the Scenario

📕: Scenario Before and After
😐 first step executed
😂 second step executed
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you have added an emoji version for every test. I think that's too much for one feature, otherwise the codebase will grow exponentially and maintenance will be a headache. Please remove all these new feature files for emoji. Just create one feature file and one feature class for emoji version and that will prove the point. You can make that feature as advanced as you can, but keep everything in one feature. I will not be reviewing so many files for the same thing.

Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
using System.Threading;

namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./CucumberExpressions/PassParameters.em.feature")]
public class PassParameters : CucumberExpressions.PassParameters { }
}

namespace Xunit.Gherkin.Quick.ProjectConsumer.CucumberExpressions
{
[FeatureFile("./CucumberExpressions/PassParameters.feature")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

# language: em

📚: pass parameters
In order to simplify use of regex
I want to use cucumber expressions in feature steps


📕: Pass positive integer to step function
🎬 I pass the integer value 10 using cucumber expression
🙏 the received integer value is 10 using regex


📕: Pass negative integer to step function
🎬 I pass the integer value -22 using cucumber expression
🙏 the received integer value is -22 using regex


📕: Pass integer zero to step function
🎬 I pass the integer value 0 using cucumber expression
🙏 the received integer value is 0 using regex


📕: Pass positive float to step function
🎬 I pass the float value 10.25 using cucumber expression
🙏 the received float value is 10.25 using regex


📕: Pass negative float to step function
🎬 I pass the float value -20.25 using cucumber expression
🙏 the received float value is -20.25 using regex


📕: Pass float zero to step function
🎬 I pass the float value 0 using cucumber expression
🙏 the received float value is 0 using regex


📕: Pass float zero dot zero to step function
🎬 I pass the float value 0.0 using cucumber expression
🙏 the received float value is 0.0 using regex


📕: Pass word to step function
🎬 I pass the word Max using cucumber expression
🙏 the received word is Max using regex


📕: Pass double quoted string to step function
🎬 I pass the string "11 and A B C" using cucumber expression
🙏 the received string is "11 and A B C" using regex


📕: Pass double quoted string with single quotes to step function
🎬 I pass the string "11 and 'A' or 'B' or 'C'" using cucumber expression
🙏 the received string is "11 and 'A' or 'B' or 'C'" using regex


📕: Pass empty string to step function
🎬 I pass the string "" using cucumber expression
🙏 the received string is "" using regex


📕: Pass single quoted string to step function
🎬 I pass the string '11 and A B C' using cucumber expression
🙏 the received string is "11 and A B C" using regex


📕: Pass single quoted string with double quotes to step function
🎬 I pass the string '11 and "A" and "B" and "C"' using cucumber expression
🙏 the received string is '11 and "A" and "B" and "C"' using single quotes regex


📕: Pass single quoted empty string to step function
🎬 I pass the string '' using cucumber expression
🙏 the received string is "" using regex


📕: Pass anything to step function
🎬 I say Quasimodo the Grand
🙏 it is the same as "Quasimodo the Grand"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Xunit.Gherkin.Quick.ProjectConsumer.Addition
{
public sealed partial class AddTwoNumbers
public partial class AddTwoNumbers
{
[Given(@"following table of (\d+) inputs and outputs:")]
public void Following_table_of_inputs_and_outputs(int inputCount, DataTable dataTable)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
using Gherkin.Ast;
using System.Text;

namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./DocString/TextBuilder.em.feature")]
public class TextBuilder : Texts.TextBuilder { }
}

namespace Xunit.Gherkin.Quick.ProjectConsumer.Texts
{
[FeatureFile("./DocString/TextBuilder.feature")]
public sealed class TextBuilder : Feature
public class TextBuilder : Feature
{
private StringBuilder _textBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# language: em

📚: Text Builder
In order to manipulate text
As a text nerd
I need to have a Text Builder mechanism

📕: Replacing words in text
😐 I have a text like this:
"""
Hello word

The word is beautiful.
Isn't it?

I'm coming word
"""
🎬 I replace 'word' with 'world'
🙏 I should have text like this:
"""
Hello world

The world is beautiful.
Isn't it?

I'm coming world
"""
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@

namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./GivenWhenThenTests/EnsureOrderOfSteps.em.feature")]
public class EnsureOrderOfSteps : ProjectConsumer.EnsureOrderOfSteps { }

}

namespace Xunit.Gherkin.Quick.ProjectConsumer
{

[FeatureFile("./GivenWhenThenTests/EnsureOrderOfSteps.feature")]
public sealed class EnsureOrderOfSteps : Feature
public class EnsureOrderOfSteps : Feature
{
private int _order = 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# language: em

📚: 😐 🎬 Then
In order to use 😐 🎬 🙏 and other attributes
As a Gherkin enthusiast
I want to ensure they map to methods

📕: Ensure order of steps
😐 Sample text for Given
😂 Sample text for And after Given
😔 Sample text for But after Given
🎬 Sample text for When
😂 Sample text for And after When
😔 Sample text for But after When
🙏 Sample text for Then
😂 Sample text for And after Then
😔 Sample text for But after Then
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
using System.Globalization;
using System.Threading;

namespace Xunit.Gherkin.Quick.ProjectConsumer.Emoji
{
[FeatureFile("./GivenWhenThenTests/SimpleParameterTypes.em.feature")]
public class SimpleParameterTypes : ProjectConsumer.SimpleParameterTypes { }
}

namespace Xunit.Gherkin.Quick.ProjectConsumer
{
[FeatureFile("./GivenWhenThenTests/SimpleParameterTypes.feature")]
public sealed class SimpleParameterTypes : Feature
public class SimpleParameterTypes : Feature
{
public SimpleParameterTypes()
{
Expand Down
Loading