temyers / cucumber-jvm-parallel-plugin

Maven plugin to help running Cucumber features in parallel
Apache License 2.0
129 stars 121 forks source link

Cucumber "#language"-Tag does not seem to be recognized (anymore?) #150

Closed froemra closed 6 years ago

froemra commented 6 years ago

I am upgrading from plugin Version 1.3.0 to 4.2.0. I did all the migrations you docoumented to my maven pom. Now, when generating the runners, the cucumber #language-Tag does not seem to be recognized (we are using feature files in german, which is supported by cucumber. This worked fine in 1.3.0, but now I am getting errors like:

[ERROR] Failed to execute goal com.github.temyers:cucumber-jvm-parallel-plugin:4.2.0:generateRunners (generateRunners) on project test-stest: Execution generateRunners of goal com.github.temyers:cucumber-jvm-parallel-plugin:4.2.0:generateRunners failed: Parser errors:
[ERROR] (5:1): expected: #TagLine, #FeatureLine, #Comment, #Empty, got 'Funktionalität: Anwendungsfall 1'
[ERROR] (7:3): expected: #TagLine, #FeatureLine, #Comment, #Empty, got 'Szenariogrundriss: Vorbedingungen'
[...]

It seems like the plugin is expecting "Feature:" where we use "Funktionalität:" which is the german version. I am curious, as this worked with 1.3.0.

Any Ideas?

Cheers, Ray

froemra commented 6 years ago

I narrowed the problem down a little bit: It's broken since V2.0.0. My guess is, this is linked to "PR #68 - Support generating runners per scenario". Maybe the .feature-files are scanned hardcoded for englisch keywords?

froemra commented 6 years ago

Did a little bit more of research: The plugin uses cucumber to parse the feature files since 2.0. I guess the language setting is not set correctly within the gherkin parser, otherwise it should work. Don't know exactly how its done, maybe you could look into it?

Cheers, Ray

mpkorstanje commented 6 years ago

Could you create a failing integration test in the src/it/ folder?

froemra commented 6 years ago

Yeah, I really tried that. Dependency issues etc when running the existing it-tests, I do not know how people configure that stuff to run correctly. All the maven poms are empty/templates, so this seems to need Configuration in IntelliJ directly. I usually don't do that, thus do not know how ...

But it should be really easy: Just copy an existing test and replace the tags with german tags. E.g. for "simple-it" replace the contents of feature1.feature with the following:

#language:de
Funktionalität: Feature1

  Szenario: Generate Junit Runner for each feature file
    Gegeben sei I have feature files
    Wenn I generate Maven sources
    Dann the file "target/generated-test-sources/1IT.java" should exist
    Und it should contain:
    """
    @RunWith(Cucumber.class)
    @CucumberOptions(
        strict = true,
        features = {"classpath:features/feature1.feature"},
        format = {"json:target/cucumber-parallel/1.json",
    "pretty"},
        monochrome = false,
        tags = {"@complete", "@accepted"},
        glue = {"foo", "bar"})
    public class Parallel01IT {
    }
    """

The Test should run correctly, but the plugin will fail in line 2 encountering "Funktionalität" instead of "Feature". The Comment "#language:de" is usually parsed by cucumber and sets language to german.

mpkorstanje commented 6 years ago

You can run the integration tests using mvn clean install -Prun-its.

As is I can't reproduce your problem. If you can't get the integration tests to work a minimal, complete, and verifiable example in the form of a github project would also help.

froemra commented 6 years ago

Ok, I wrote a failing test. I created a local branch, but I am not allowed to push it:

remote: Permission to temyers/cucumber-jvm-parallel-plugin.git denied to froemra. fatal: unable to access 'https://github.com/temyers/cucumber-jvm-parallel-plugin.git/': The requested URL returned error: 403

Need a little help here. Sorry, I am new to guthub :) What is correct workflow?

temyers commented 6 years ago

No problem.

Fork the repository and you can then push your changes to your repository and create a Pull Request from there

temyers commented 6 years ago

https://help.github.com/articles/fork-a-repo/

froemra commented 6 years ago

Thanks! Just created the request.

mpkorstanje commented 6 years ago

@froemra You might want to check your files with a hex-editor. I wouldn't be surprised if you have a Byte Order Marker at the start of your file. Managed to reproduce this error that way while using Sublime.

froemra commented 6 years ago

@mpkorstanje Thanks for the hint. I just added a bom on my mac, where the build is working. It fails now, but the error message is different from the one i get on my windows machine at work. I guess it is best to close the pull request for now, as this seems to be a local problem on my dev environment.

froemra commented 6 years ago

@mpkorstanje Thanks for you help! Closing it now.

mpuertao commented 6 years ago

Good days @froemra .

I have the same problem, I'm trying to play my scenes in Spanish with the jvm cucumber plugin, but it throws me the same error I was throwing into your project. But I do not understand the solution you gave to your project.

You can help me solve it, my language to Spanish configurations.

Very thanks

froemra commented 6 years ago

In fact, I did not find a solution. I was sticking to an older Version which worked. Now we switched to gradle, so we need a different solution anyway. Sorry :(

Cheers, Ray

Ostryak commented 6 years ago

Encoding was the root cause in my case: when I performed "mvn --version" I got

platform encoding: Cp1251

I already configured pom.xml to use UTF-8: `

UTF-8 ` when I have changed encoding to UTF8 (in windows: >SET MAVEN_OPTS=%MAVEN_OPTS% -Dfile.encoding="UTF-8" Then plugin executed successfully.
froemra commented 6 years ago

Thanks! I’ll give that a try.

Cheers, Rainer

Am 24.09.2018 um 15:48 schrieb Ostryak notifications@github.com:

Encoding was the root cause in my case: when I performed "mvn --version" I got

platform encoding: Cp1251

I already configured pom.xml to use UTF-8:

UTF-8

when I have changed encoding to UTF8 (in windows:

SET MAVEN_OPTS=%MAVEN_OPTS% -Dfile.encoding="UTF-8"

Then plugin executed successfully.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/temyers/cucumber-jvm-parallel-plugin/issues/150#issuecomment-423980793, or mute the thread https://github.com/notifications/unsubscribe-auth/Af7c3BkUZU3RwhehjGf2WLV2BVgEw4qTks5ueOK-gaJpZM4QWBjO.