How to use gherkin localization in Karate framework? - localization

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?

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 :)

Related

Lua error -129 for most mediawiki templates

I've been attempting to import some wikipedia templates in my local mediawiki wiki, but most attempts at using them end up with the same error. For instance, for the following code :
==Title==
{{Main|Title}}
(which uses the main template), I get the following error :
Lua error: Internal error: The interpreter has terminated with signal "-129".
No further details are available.
I haven't been able to find any occurence of that error, or even a relevant use of 129 in the source code I could find, and there is nothing generated in the Lua error log.
The Lua binaries have all been given permission to be executed, and I have installed the Scribunto and TemplateStyles extensions and a variety of modules, although beyond the ones advised for main, I don't know where to find a list of missing modules if there are any.
Edit : Here is the output of $status in Scribunto :
array(8) {
["command"]=> string(459) "'exec' '/bin/sh' '/XXX/extensions/Scribunto/includes/engines/LuaStandalone/lua_ulimit.sh' '7' '8' '51200' ''\''/XXX/extensions/Scribunto/includes/engines/LuaStandalone/binaries/lua5_1_5_linux_32_generic/lua'\'' '\''/XXX/extensions/Scribunto/includes/engines/LuaStandalone/mw_main.lua'\'' '\''/XXX/extensions/Scribunto/includes'\'' '\''0'\'' '\''4'\'''"
["pid"]=> int(17067)
["running"]=> bool(false)
["signaled"]=> bool(true)
["stopped"]=> bool(false)
["exitcode"]=> int(-1)
["termsig"]=> int(-129)
["stopsig"]=> int(0)
}
I am beginning to suspect that the issue may be that my server doesn't allow executables.

Error Deploying Scriptable-Transform in Spring Cloud Data Flow : ParserException

I'm trying to construct a stream in spring cloud data flow with kafka-based scriptable transform. I followed the instruction here:
https://docs.spring.io/spring-cloud-stream-app-starters/docs/Celsius.SR2/reference/htmlsingle/#spring-cloud-stream-modules-scriptable-transform
and my stream definition looks like this:
:SCDF_SORUCE > scriptable-transformer --language=ruby --script="return ""#{payload} extended"";" > :SCDF_DESTINATION
The "scriptable-transformer" app is registered with the following uri:
maven://org.springframework.cloud.stream.app:scriptable‑transform‑processor‑kafka:2.0.0.RELEASE
When I tried to deploy the stream, I see the following error in my skipper log:
org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
in 'reader', line 13, column 5:
"spring.metrics.export.triggers. ...
^
expected <block end>, but found Scalar
in 'reader', line 18, column 40:
... riptable-transformer.script": ""return ""#{payload} extended"";""
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:569) ~[snakeyaml-1.17.jar!/:na]
I've also tried to use js and python script, but got similar results.
How could I fix this error?
Here is a short summary of the scdf version being used:
- scdf local server: 1.5.2.RELEASE
- skipper server: 1.0.7.RELEASE
I believe you are referring to the scriptable-transform (not scriptable-transformER) app?
Anyway i've tried it and can confirm the issue when using the same transform expression in Skipper mode (expression works as it is in classic mode).
However if you replace the double with single quotes i believe it will resolve the issue. Following pipeline works fine for me with Kafka, Skipper:
time | scriptable-transform --scriptable-transformer.language=ruby --scriptable-transformer.script="return '#{payload} extended';" | log
I will investigate further to figure out if this is a documentation or code issue. In the meantime could you pleas try to above mention workaround and let me know if it solves to problem?
Thanks

Determining ANTLR version to use, or converting between?

I want to take the .g files from Apache Hive and build a parser (targeting JavaScript) -- initially, as just a way to validate user-input Hive queries. The files I'm using come from apache-hive-1.0.0-src\ql\src\java\org\apache\hadoop\hive\ql\parse from the Hive tgz: HiveLexer.g, HiveParser.g, FromClauseParser.g, IdentifiersParser.g, SelectClauseParser.g.
I see no indication within the grammar files which version of ANTLR to use, so I've tried running antlr (from apt-get pccts), antlr3 and antlr4. they all throw errors of some sort, so I have no clue which one to run or if I can (or need to) convert the .g files between versions.
The errors I'm getting are as follows:
antlr -Dlanguage=JavaScript HiveParser.g (looks like it doesn't support JS anyway):
warning: invalid option: '-Dlanguage=JavaScript'
HiveParser.g, line 17: syntax error at "grammar" missing { QuotedTerm PassAction ! \< \> : }
HiveParser.g, line 17: syntax error at "HiveParser" missing { QuotedTerm PassAction ! \< \> : }
HiveParser.g, line 17: syntax error at ";" missing Eof
HiveParser.g, line 28: lexical error: invalid token (text was ',')
antlr3 -Dlanguage=JavaScript HiveParser.g:
error(10): internal error: Exception FromClauseParser.g:302:85: unexpected char: '-'#org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:347): unexpected stream error from parsing FromClauseParser.g
error(150): grammar file FromClauseParser.g has no rules
error(100): FromClauseParser.g:0:0: syntax error: assign.types: <AST>:299:68: unexpected AST node: ->
error(100): FromClauseParser.g:0:0: syntax error: define: <AST>:299:68: unexpected AST node: ->
error(106): SelectClauseParser.g:151:18: reference to undefined rule: tableAllColumns
antlr4 -Dlanguage=JavaScript HiveParser.g:
warning(202): HiveParser.g:30:0: tokens {A; B;} syntax is now tokens {A, B} in ANTLR 4
error(50): HiveParser.g:636:34: syntax error: '->' came as a complete surprise to me while looking for rule element
error(50): HiveParser.g:636:37: syntax error: '^' came as a complete surprise to me
error(50): HiveParser.g:638:50: syntax error: '->' came as a complete surprise to me while looking for rule element
error(50): HiveParser.g:638:53: syntax error: '^' came as a complete surprise to me
The antlr3 error referencing #org.antlr.grammar.v2.ANTLRLexer.nextToken seems suspect. Is it using the v2 lexer instead of v3? If so, maybe v3 is what I should target, but it's somehow not hitting it?
Or is this not an issue with versioning and instead with invocation? Or is Hive built in a way that provides additional files needed?
According to Hive source code, they use ANTLR 3.4. But before you start remove the last string from FromClauseParser.g
//------------------------------------------------------------------------

Paamayim nekudotayims in PHP 5.2

I can upgrade php 5.2 in my server. I have to make this server work today (the vacation I have planned tomorrow is under question because of this error) with new testlink. I am stuck with following error i.e Paamayim nekudotayims.
What changes I should do to resolve it?
This link contains the file with the bug.
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
SO may be in your codes you try to call static method or properties with wrong operator.
From Wikipedia:
In PHP, the scope resolution operator is also called Paamayim
Nekudotayim (Hebrew: פעמיים נקודתיים‎), which means “double colon” in
Hebrew.
The name "Paamayim Nekudotayim" was introduced in the
Israeli-developed Zend Engine 0.5 used in PHP 3. Although it has been
confusing to many developers who do not speak Hebrew, it is still
being used in PHP 5, as in this sample error message:
$ php -r :: Parse error: syntax error, unexpected
T_PAAMAYIM_NEKUDOTAYIM
As of PHP 5.4, error messages concerning the scope resolution operator
still include this name, but have clarified its meaning somewhat:
$ php -r :: Parse error: syntax error, unexpected '::'
(T_PAAMAYIM_NEKUDOTAYIM)

How to show mbunit/gallio TestLog or Console output in Jenkins?

I'm using Gallio/MbUnit framework for my web testing, and the tests are kicked off from Jenkins. I've installed the Gallio/MbUnit plugin and it's publishing the xml report. I'm trying to find a way to display test log or console messages in the "Test Result" section so the team can easily read failures instead of digging into the "Console Output" for any failed test run.
When I run these Gallio/MbUnit tests from my local machine using Icarus everything is pretty nicely formatted, but not so much with Jenkins. I'd like to keep using it and improve how we display the errors. Suggestions?
For a failed test:
Failed
...MainMenuTests.AcctClaimsItems
Failing for the past 4 builds (Since Failed#128 )
Took 47 sec.
add description
Error Message
Expected value to be false.Actual Value : d:\Jenkins\jobs\...\workspace\WebTesting\Base\Helpers.cs:line 90d:\Jenkins\jobs\...\workspace\WebTesting\TigerEye\Tests\MainMenuTests.cs:line 329true
Stacktrace
at WebTesting.Base.Helpers.Click(IWebDriver driver, IWebElement element) in
From the raw console output:
Start time: 4:21 PM
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[failed] Test WebTesting/MainMenuTests/AcctClaimsItems
Expected value to be false.
Found System.Web Exception after click to url
.../Accounting/FETReport.aspx
Actual Value : true
at WebTesting.Base.Click(IWebDriver driver, IWebElement element) in d:\Jenkins\jobs\...\workspace\WebTesting\Base\StaticHelpers.cs:line 90 at WebTesting...\Tests.MainMenuTests.AcctClaimsItems() in d:\Jenkins\jobs\...\workspace\WebTesting\TigerEye\Tests\MainMenuTests.cs:line 329
Code:
if (driver.PageSource.Contains("System.Web - Exception"))
{
TestLog.Write("Found exception on page {0}", driver.Url);
TestLog.Write(driver.PageSource.ToString());
Console.Write("Found exception on page {0}", driver.Url);
Console.Write(driver.PageSource.ToString());
Assert.IsFalse(driver.PageSource.Contains("System.Web - Exception"), "Found System.Web Exception after click to url {0}",driver.Url);
}
There is a general console parsing plugin you can use to add a post build step https://wiki.jenkins-ci.org/display/JENKINS/Log+Parser+Plugin

Resources