I am writing some tests to get total count from from an api.
The api response { "IntuitResponse": { "_": { "QueryResponse": { "_": null, "@": { "totalCount": "49" } } }, "@": { "time": "2020-12-22T12:40:52.184-08:00", "xmlns": "http://schema.intuit.com/finance/v3" } } }
I can assert this in json file
{ "path": "IntuitResponse._.QueryResponse.@.totalCount", "operand": "==", "value": "#notnull" }
But when I try to read this value in feature file I get below exception.
java.lang.RuntimeException: javascript evaluation failed: (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)), <eval>:1:88 Expected ident but found error (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)) ^ in <eval> at line number 1 at column number 88 at com.intuit.karate.ScriptBindings.eval(ScriptBindings.java:144) at com.intuit.karate.ScriptBindings.updateBindingsAndEval(ScriptBindings.java:134) at com.intuit.karate.ScriptBindings.evalInNashorn(ScriptBindings.java:119) at com.intuit.karate.Script.evalJsExpression(Script.java:371) at com.intuit.karate.Script.evalKarateExpression(Script.java:285) at com.intuit.karate.Script.evalKarateExpression(Script.java:171) at com.intuit.karate.Script.setValueByPath(Script.java:1483) at com.intuit.karate.Script.setValueByPath(Script.java:1479) at com.intuit.karate.StepDefs.setNamedByPath(StepDefs.java:572) at com.intuit.karate.StepDefs.setByPath(StepDefs.java:562) at ✽.* set session.runtimeData.activeCount = (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount))(/Users/prao2/dev/overwatch-v3-tests/src/test/java/com/intuit/v3/taxcode/test/taxcode.feature:21) Caused by: javax.script.ScriptException: <eval>:1:88 Expected ident but found error (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)) ^ in <eval> at line number 1 at column number 88 at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:537) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:524) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) at com.intuit.karate.ScriptBindings.eval(ScriptBindings.java:139) at com.intuit.karate.ScriptBindings.updateBindingsAndEval(ScriptBindings.java:134) at com.intuit.karate.ScriptBindings.evalInNashorn(ScriptBindings.java:119) at com.intuit.karate.Script.evalJsExpression(Script.java:371) at com.intuit.karate.Script.evalKarateExpression(Script.java:285) at com.intuit.karate.Script.evalKarateExpression(Script.java:171) at com.intuit.karate.Script.setValueByPath(Script.java:1483) at com.intuit.karate.Script.setValueByPath(Script.java:1479) at com.intuit.karate.StepDefs.setNamedByPath(StepDefs.java:572) at com.intuit.karate.StepDefs.setByPath(StepDefs.java:562) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at cucumber.runtime.Utils$1.call(Utils.java:40) at cucumber.runtime.Timeout.timeout(Timeout.java:16) at cucumber.runtime.Utils.invoke(Utils.java:34) at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38) at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37) at cucumber.runtime.Runtime.runStep(Runtime.java:300) at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.model.CucumberScenarioOutline.run(CucumberScenarioOutline.java:46) at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165) at cucumber.runtime.Runtime.run(Runtime.java:122) at cucumber.api.cli.Main.run(Main.java:36) at cucumber.api.cli.Main.main(Main.java:18) Caused by: jdk.nashorn.internal.runtime.ParserException: <eval>:1:88 Expected ident but found error (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)) ^ at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:294) at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:279) at jdk.nashorn.internal.parser.AbstractParser.expectDontAdvance(AbstractParser.java:350) at jdk.nashorn.internal.parser.AbstractParser.expect(AbstractParser.java:337) at jdk.nashorn.internal.parser.AbstractParser.getIdentifierName(AbstractParser.java:501) at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2541) at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372) at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147) at jdk.nashorn.internal.parser.Parser.assignmentExpression(Parser.java:3353) at jdk.nashorn.internal.parser.Parser.argumentList(Parser.java:2588) at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2375) at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147) at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282) at jdk.nashorn.internal.parser.Parser.primaryExpression(Parser.java:1992) at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2511) at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372) at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147) at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282) at jdk.nashorn.internal.parser.Parser.expressionStatement(Parser.java:1150) at jdk.nashorn.internal.parser.Parser.statement(Parser.java:967) at jdk.nashorn.internal.parser.Parser.sourceElements(Parser.java:773) at jdk.nashorn.internal.parser.Parser.program(Parser.java:709) at jdk.nashorn.internal.parser.Parser.parse(Parser.java:283) at jdk.nashorn.internal.parser.Parser.parse(Parser.java:249) at jdk.nashorn.internal.runtime.Context.compile(Context.java:1284) at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1251) at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:627) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:535) ... 32 more
I am writing some tests to get total count from from an api. The api response
{ "IntuitResponse": { "_": { "QueryResponse": { "_": null, "@": { "totalCount": "49" } } }, "@": { "time": "2020-12-22T12:40:52.184-08:00", "xmlns": "http://schema.intuit.com/finance/v3" } } }
I can assert this in json file{ "path": "IntuitResponse._.QueryResponse.@.totalCount", "operand": "==", "value": "#notnull" }
But when I try to read this value in feature file I get below exception.
java.lang.RuntimeException: javascript evaluation failed: (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)), <eval>:1:88 Expected ident but found error (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)) ^ in <eval> at line number 1 at column number 88 at com.intuit.karate.ScriptBindings.eval(ScriptBindings.java:144) at com.intuit.karate.ScriptBindings.updateBindingsAndEval(ScriptBindings.java:134) at com.intuit.karate.ScriptBindings.evalInNashorn(ScriptBindings.java:119) at com.intuit.karate.Script.evalJsExpression(Script.java:371) at com.intuit.karate.Script.evalKarateExpression(Script.java:285) at com.intuit.karate.Script.evalKarateExpression(Script.java:171) at com.intuit.karate.Script.setValueByPath(Script.java:1483) at com.intuit.karate.Script.setValueByPath(Script.java:1479) at com.intuit.karate.StepDefs.setNamedByPath(StepDefs.java:572) at com.intuit.karate.StepDefs.setByPath(StepDefs.java:562) at ✽.* set session.runtimeData.activeCount = (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount))(/Users/prao2/dev/overwatch-v3-tests/src/test/java/com/intuit/v3/taxcode/test/taxcode.feature:21) Caused by: javax.script.ScriptException: <eval>:1:88 Expected ident but found error (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)) ^ in <eval> at line number 1 at column number 88 at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:537) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:524) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) at com.intuit.karate.ScriptBindings.eval(ScriptBindings.java:139) at com.intuit.karate.ScriptBindings.updateBindingsAndEval(ScriptBindings.java:134) at com.intuit.karate.ScriptBindings.evalInNashorn(ScriptBindings.java:119) at com.intuit.karate.Script.evalJsExpression(Script.java:371) at com.intuit.karate.Script.evalKarateExpression(Script.java:285) at com.intuit.karate.Script.evalKarateExpression(Script.java:171) at com.intuit.karate.Script.setValueByPath(Script.java:1483) at com.intuit.karate.Script.setValueByPath(Script.java:1479) at com.intuit.karate.StepDefs.setNamedByPath(StepDefs.java:572) at com.intuit.karate.StepDefs.setByPath(StepDefs.java:562) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at cucumber.runtime.Utils$1.call(Utils.java:40) at cucumber.runtime.Timeout.timeout(Timeout.java:16) at cucumber.runtime.Utils.invoke(Utils.java:34) at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38) at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37) at cucumber.runtime.Runtime.runStep(Runtime.java:300) at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.model.CucumberScenarioOutline.run(CucumberScenarioOutline.java:46) at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165) at cucumber.runtime.Runtime.run(Runtime.java:122) at cucumber.api.cli.Main.run(Main.java:36) at cucumber.api.cli.Main.main(Main.java:18) Caused by: jdk.nashorn.internal.runtime.ParserException: <eval>:1:88 Expected ident but found error (parseInt(result1.session.runtimeData.read_taxcode_count.IntuitResponse._.QueryResponse.@.totalCount)) ^ at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:294) at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:279) at jdk.nashorn.internal.parser.AbstractParser.expectDontAdvance(AbstractParser.java:350) at jdk.nashorn.internal.parser.AbstractParser.expect(AbstractParser.java:337) at jdk.nashorn.internal.parser.AbstractParser.getIdentifierName(AbstractParser.java:501) at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2541) at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372) at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147) at jdk.nashorn.internal.parser.Parser.assignmentExpression(Parser.java:3353) at jdk.nashorn.internal.parser.Parser.argumentList(Parser.java:2588) at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2375) at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147) at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282) at jdk.nashorn.internal.parser.Parser.primaryExpression(Parser.java:1992) at jdk.nashorn.internal.parser.Parser.memberExpression(Parser.java:2511) at jdk.nashorn.internal.parser.Parser.leftHandSideExpression(Parser.java:2372) at jdk.nashorn.internal.parser.Parser.unaryExpression(Parser.java:3147) at jdk.nashorn.internal.parser.Parser.expression(Parser.java:3282) at jdk.nashorn.internal.parser.Parser.expressionStatement(Parser.java:1150) at jdk.nashorn.internal.parser.Parser.statement(Parser.java:967) at jdk.nashorn.internal.parser.Parser.sourceElements(Parser.java:773) at jdk.nashorn.internal.parser.Parser.program(Parser.java:709) at jdk.nashorn.internal.parser.Parser.parse(Parser.java:283) at jdk.nashorn.internal.parser.Parser.parse(Parser.java:249) at jdk.nashorn.internal.runtime.Context.compile(Context.java:1284) at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1251) at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:627) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:535) ... 32 more