-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for more languages #96
Comments
I've run in to this issue as well and started looking in to it. Test case After debugging for a bit I found a few things; When setting a breakpoint here you can see the file is parsed and returns what seems to be a perfectly fine But if for what ever reason the parsing fails it does throw an error there detailing the problem but it never seems to surface anywhere to inform the developer there is a problem with a specific feature file. I ran in to this as Will continue on this. |
After debugging some more I found the following snippet: // StepMethodInfo in <>/source/Xunit.Gherkin.Quick/CoreModel/StepMethod/StepMethodInfo.cs
public ScenarioStepPattern GetMatchingPattern(Step gherkinScenarioStep)
{
var gherkinStepText = gherkinScenarioStep.Text.Trim();
foreach (var pattern in ScenarioStepPatterns)
{
if (!pattern.Kind.Matches(gherkinScenarioStep.Keyword.Trim()))
continue;
var match = Regex.Match(gherkinStepText, pattern.RegexPattern);
if (!match.Success || !match.Value.Equals(gherkinStepText))
continue;
return pattern;
}
return null;
} In the dutch test the value of |
So after a little digging it seems the most reasonable thing to do is to start with updating the version of Gherkin used. A more recent version of version of the parser also exposes the step types, using this info it wouldn't be necessary to guess the type of step based on the (translated) keyword. |
The problem with that approach is that Gherkin has breaking changes, so if you try to upgrade, that opens up a whole new can of worms. Maybe I'm mistaken, but that's what I remember from the last time I tried to upgrade. |
I just found that out... 😅. But moving I'm having a little troubling finding a good change log for Gherkin, would you by chance know where to find one? |
No, I don't know where to find that. In fact, I reached out to them with the request to document the new AST (abstract syntax tree, i.e., the new object model), but they haven't done it yet I assume. |
Ah, I think I found the commit with the relevant changes! the commit. It seems to rename |
I just did some brute force renaming to get the project to compile again and run the unit tests. And I have to say, the results are not half bad. This is obviously the easy 80 percent of this endeavour. 😃 (relevant commit) |
After fixing the background unit test I'm left with 5 integration tests which don't work:
And For example setting a breakpoint here( So my question here is, how fresh is this code? Am I looking at the right place? |
Two things: No test should fail, otherwise, the build will fail, which will not let me merge the PR. So, all tests must pass. Please download the original version of the code and verify, that there should not be any failures. You are looking at an image, which is outdated (sorry). Here is the up-to-date diagram of the same topic: |
After giving this a little rest I continued today, I had a hunch that maybe XUnit was just confused on what tests to run so cleaning the entire thing and giving it another spin the So I think I might have messed up the lookups, but I'm not completely sure how. |
HA! Checking out It seems that in my fork somehow the scenario outlines are discovered as regular scenarios, which are then executed but fail. So this is not a issue with the execution of the tests but the classification/discover of them. |
Yay, I fixed the scenario outline issue. It isn't super elegant but for now this does the job well. (commit) The only two things left now are handling the not implemented tests and feature files in other languages. |
So looking at the the "Math with infinity" it obviously fails because it is a scenario without examples (the examples table is I'm initially going to do this without changing too much to the discovery and distinction between scenarios and outlines but looking at what Gherkin is doing it does seem like a good idea to fold these in to one. |
Well, Gherkin's design is not exemplary (with all due respect). The idea behind the Xunit.Gherkin.Quick's design is that it should reflect the concepts that exist within the BDD context. If we combine Scenario Outline and Scenario, my initial concern is that it will add abstraction rather than clarify what is really going on. There must be strong design reason (not Gherkin's approach) to go with one or another pattern. |
YAY, I got mu dutch test working! It is also funny that with the exception of the "Math with infinities" all tests in the |
Done! Everything passes, I want to add a few more tests in the project and translate these to emjoi-lang so not to favor any specific langauge. Maybe do some more clean up here and there. I'm going to open a PR. |
I have tested a local build of this package on the project where I intend to use it in and ran in to some weirdness with other languages. So although all tests pass now I am going to translate every feature file in A pattern I found to do make the same public partial class Letter : Feature {
[FeatureFile("A.feature")] public class A : Letter { }
[FeatureFile("B.feature")] public class B : Letter { }
//
// Given, When. Then methods go here
//
} |
I found the issue was! And it didn't have anything to do with the workings of When looking at it through the NuGet browser in visual studio it does say it has the correct dependencies but when installing it it just picks up the public package from NuGet.org. (That was because they are both version 4.2.0, I think) Upping the version number made sure the correct (local) package was installed. Which also, just worked 😄 I'm going to take a look at appveyor later, there is quite a section on how to automagically bump the version number when creating a release build. |
One of the main features of gherkin is the support for writing scenarios and features in your own language. It seems like this project only supports steps written in english.
Please add support for more languages.
A list of translations for the different keywords can be found here:
https://github.com/cucumber/cucumber/blob/master/gherkin/gherkin-languages.json
The text was updated successfully, but these errors were encountered: