trivago/cucable-plugin

Utf-8 error for linux

SungurOnur opened this issue · 4 comments

Describe the bug
Platform: Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-169-generic x86_64)
Command: mvn clean verify

Source feature file:
Feature: Login

@Login
Scenario: Login
Given Successful login
Then Username is "İ"

Generated Scenarios:
# language: en
Feature: Login

@Login
Scenario: Login
Given Successful login
Then Username is "??"

Error: java.lang.AssertionError: Wrong username. expected [true] but found [false]

Properties

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
   </properties>

Dependencies

<dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.java.version}</version>
        </dependency>
        <dependency>
            <groupId>com.trivago.rta</groupId>
            <artifactId>cucable-plugin</artifactId>
            <version>1.4.0</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-cucumber-jvm</artifactId>
            <version>${allure.jvm}</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>${allure.jvm}</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${info.cukes}</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${info.cukes}</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>${info.cukes}</version>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>gherkin</artifactId>
            <version>2.12.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>3.15.0</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>23.0</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-cucumber-jvm-adaptor</artifactId>
            <version>1.6.4</version>
        </dependency>
        <dependency>
            <groupId>org.beanshell</groupId>
            <artifactId>bsh</artifactId>
            <version>2.0b5</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.log4j12.version}</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.dpaukov</groupId>
            <artifactId>combinatoricslib3</artifactId>
            <version>3.3.0</version>
        </dependency>
    </dependencies>

Cucable Plugin

<plugin>
               <groupId>com.trivago.rta</groupId>
               <artifactId>cucable-plugin</artifactId>
               <version>1.5.3</version>
               <executions>
                   <execution>
                       <id>generate-test-resources</id>
                       <phase>generate-test-resources</phase>
                       <goals>
                           <goal>parallel</goal>
                       </goals>
                   </execution>
               </executions>
               <configuration>
                   <!-- Required properties -->
                   <sourceRunnerTemplateFile>src/test/java/testrunners/CucableJavaTemplate.java
                   </sourceRunnerTemplateFile>
                   <sourceFeatures>src/test/resources/Feature</sourceFeatures>
                   <generatedFeatureDirectory>target/parallel/features</generatedFeatureDirectory>
                   <generatedRunnerDirectory>target/parallel/runners</generatedRunnerDirectory>

                   <!-- Optional properties -->
                   <numberOfTestRuns>1</numberOfTestRuns>
                   <includeScenarioTags>${tag}</includeScenarioTags>
                   <logLevel>compact</logLevel>

                   <desiredNumberOfRunners>2</desiredNumberOfRunners>
                   <!--<desiredNumberOfFeaturesPerRunner>1</desiredNumberOfFeaturesPerRunner>-->
               </configuration>
           </plugin>

How can i handle this error ?

Hello, I won't be able to look at it this week. Will have to move it to the next.

Unfortunatelly I couldn't reproduce this since I am on mac os. There is works as expected. Did you also try it on another machine?

Mac OS and Windows : 👍

Hi,
These functions doesn't work on linux.(For my case) Can u add an encoding parameter? Thanks.

public void writeContentToFile(String content, String filePath) throws FileCreationException { try { FileUtils.fileWrite(filePath, content); } catch (IOException e) { throw new FileCreationException(filePath); } }

// FileUtils.fileWrite(filePath, "UTF-8", content);

public String readContentFromFile(String filePath) throws MissingFileException { try { return FileUtils.fileRead(filePath); } catch (IOException e) { throw new MissingFileException(filePath); } }

//FileUtils.fileRead(filePath, "UTF-8");

Added to the upcoming release 1.6.0