необходимо преобразовать сгенерированный PDF из закодированной строки и сохранить его как pdf для сравнения.
Пример файла функции:
Feature: Compute All
Scenario: trial and error
* call read('common.feature')
* def xyz = getMDash( 'my password')
* print xyz
* call read('classpath:/test/java/com/intuit/karate/FileUtils.java')
* def doWork =
"""
function('temp.txt','hello world') {
var JavaDemo = Java.type('com.intuit.karate.FileUtils');
var jd = new JavaDemo();
jd.writeToFile('temp.txt','hello world');
}
"""
* def result = call writeToFile 'temp.txt','hello world'
* def FileUtils = Java.type('com.intuit.karate.FileUtils')
* def result = FileUtils.writeToFile('temp.txt','hello world')
с использованием приведенных примеров.
errorв журнале:
Tests run: 9, Failures: 0, Errors: 2, Skipped: 3, Time elapsed: 1.314 sec <<< FAILURE!
* def doWork =(Scenario: trial and error) Time elapsed: 0 sec <<< ERROR!
java.lang.RuntimeException: javascript evaluation failed: function('temp.txt','hello world') {
var JavaDemo = Java.type('com.intuit.karate.FileUtils');
var jd = new JavaDemo();
jd.writeToFile('temp.txt','hello world');
}
at com.intuit.karate.ScriptBindings.eval(ScriptBindings.java:115)
at com.intuit.karate.ScriptBindings.updateBindingsAndEval(ScriptBindings.java:103)
at com.intuit.karate.ScriptBindings.evalInNashorn(ScriptBindings.java:88)
at com.intuit.karate.Script.evalJsExpression(Script.java:362)
at com.intuit.karate.Script.evalKarateExpression(Script.java:284)
at com.intuit.karate.Script.evalKarateExpression(Script.java:170)
at com.intuit.karate.Script.assign(Script.java:598)
at com.intuit.karate.Script.assign(Script.java:524)
at com.intuit.karate.StepDefs.def(StepDefs.java:305)
at com.intuit.karate.StepDefs.defDocString(StepDefs.java:300)
at ?.* def doWork =(testSuite/users/dummy.feature:11)
**Caused by: javax.script.ScriptException**: <eval>:1:10 Expected ident but found temp.txt
function('temp.txt','hello world')
нужна помощь по использованию fileUtils в каратэ.