4

I want to use gherkin localization in Karate Framework.

English version of scenario works perfect. But with Russian version it looks like Karate FeatureParser doesn't know localized tags and fails. Here is the error log:

line 15:0 mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
16:44:01.263 [main] ERROR com.intuit.karate.core.FeatureParser - syntax error: mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
16:44:01.270 [main] ERROR com.intuit.karate.core.FeatureParser - not a valid feature file: src/test/java/ru.feature - mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
Exception in thread "main" java.lang.RuntimeException: mismatched input '<EOF>' expecting {FEATURE_TAGS, FEATURE}
    at com.intuit.karate.core.FeatureParser.<init>(FeatureParser.java:150)
    at com.intuit.karate.core.FeatureParser.<init>(FeatureParser.java:126)
    at com.intuit.karate.core.FeatureParser.parse(FeatureParser.java:69)
    at com.intuit.karate.IdeUtils.exec(IdeUtils.java:61)
    at cucumber.api.cli.Main.main(Main.java:36)

English version of feature file:

Feature: Services A and B
  Background:
    * url 'http://localhost:8080'

  Scenario: call service A
    Given path 'service-a'
    And method get
    Then status 200

  Scenario: call service B
    Given path 'service-b'
    And method get
    Then status 200

Russian version of feature file:

# language: ru
Функция: Сервисы А и Б
  Контекст:
    * адрес 'http://localhost:8080'

  Сценарий: вызов сервиса А
    Дано путь 'service-a'
    И метод get
    То статус 200

  Сценарий: вызов сервиса B
    Дано путь 'service-b'
    И метод get
    То статус 200

What should I do to fix it?

ZeAL0T
  • 709
  • 1
  • 12
  • 27

1 Answers1

4

Yes, Karate does not support localization after we switched away from Cucumber in version 0.9.0.

We decided not to support localization because the goals of Karate are very different from Cucumber. Karate is more like a programming language, better explained here: https://stackoverflow.com/a/47799207/143475

So just like Java or JavaScript do not support localized keywords, Karate does not either. We haven't had any complaints so far :)

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248