空手道 SET 功能未设置值
Karate SET functionality is not setting the value
在给定的代码中,我想更新 json 中的 empid,我从数据库中获取值。 empid 值是从数据库中读取的,它在控制台中正确打印,但是当我尝试设置相同的值时,我得到的异常为 null。
源代码
功能文件
Feature:Request
Scenario: Create Service
* def getResults = db.readRows(Java.type("abc.xyz").getDBValue())
* def empid = getResults.empid
* def service= { "empid": 25072801, "userName": "testuser", "reasonCode": "test cancel" }
* print service.empId
* set service.empId = empId
我没有从数据库中读取,而是给出了如下所示的值,但仍然失败
* set service.empId = 1234
异常:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running riseMap.TestParallel
23:31:01.767 [main] INFO com.intuit.karate.RunnerOptions - found system property 'karate.options': --tags @updateactiveroutesequence
Warning: Nashorn engine is planned to be removed from a future JDK release
23:31:02.651 [main] INFO com.intuit.karate.Runner - waiting for parallel features to complete ...
23:31:02.760 [ForkJoinPool-1-worker-3] INFO com.intuit.karate - karate.env system property was: dops
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via
the SPI and manual loading of the driver class is generally unnecessary.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.minidev.asm.DynamicClassLoader (file:/C:/Users/chinnsu/.m2/repository/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of net.minidev.asm.DynamicClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
23:31:04.613 [ForkJoinPool-1-worker-3] INFO com.intuit.karate - [print] 0
scenarios: 1 | passed: 0 | failed: 1 | time: 1.7240
---------------------------------------------------------
Karate version: 0.9.5
======================================================
elapsed: 2.81 | threads: 5 | thread time: 1.72
features: 1 | ignored: 62 | efficiency: 0.12
scenarios: 1 | passed: 0 | failed: 1
======================================================
failed features:
project.service: service.feature:22 - null
Jun 11, 2020 11:31:04 PM net.masterthought.cucumber.ReportParser parseJsonFiles
INFO: File 'C:\Users\chinnsu\RSG\Workspace\API\target\surefire-reports\project.service.json' contains 1 features
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.975 sec <<< FAILURE!
testParallel(project.TestParallel) Time elapsed: 3.92 sec <<< FAILURE!
java.lang.AssertionError: failed features:
project.service: service.feature:22 - null
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at project.TestParallel.testParallel(TestParallel.java:22)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
即使我尝试从一个单独的文件中读取此 json 然后我设置值,但这也不起作用
尝试不设置:
* service.empId = empId
否则这对我有用。请遵循此过程:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
在给定的代码中,我想更新 json 中的 empid,我从数据库中获取值。 empid 值是从数据库中读取的,它在控制台中正确打印,但是当我尝试设置相同的值时,我得到的异常为 null。
源代码
功能文件
Feature:Request
Scenario: Create Service
* def getResults = db.readRows(Java.type("abc.xyz").getDBValue())
* def empid = getResults.empid
* def service= { "empid": 25072801, "userName": "testuser", "reasonCode": "test cancel" }
* print service.empId
* set service.empId = empId
我没有从数据库中读取,而是给出了如下所示的值,但仍然失败
* set service.empId = 1234
异常:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running riseMap.TestParallel
23:31:01.767 [main] INFO com.intuit.karate.RunnerOptions - found system property 'karate.options': --tags @updateactiveroutesequence
Warning: Nashorn engine is planned to be removed from a future JDK release
23:31:02.651 [main] INFO com.intuit.karate.Runner - waiting for parallel features to complete ...
23:31:02.760 [ForkJoinPool-1-worker-3] INFO com.intuit.karate - karate.env system property was: dops
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via
the SPI and manual loading of the driver class is generally unnecessary.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.minidev.asm.DynamicClassLoader (file:/C:/Users/chinnsu/.m2/repository/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of net.minidev.asm.DynamicClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
23:31:04.613 [ForkJoinPool-1-worker-3] INFO com.intuit.karate - [print] 0
scenarios: 1 | passed: 0 | failed: 1 | time: 1.7240
---------------------------------------------------------
Karate version: 0.9.5
======================================================
elapsed: 2.81 | threads: 5 | thread time: 1.72
features: 1 | ignored: 62 | efficiency: 0.12
scenarios: 1 | passed: 0 | failed: 1
======================================================
failed features:
project.service: service.feature:22 - null
Jun 11, 2020 11:31:04 PM net.masterthought.cucumber.ReportParser parseJsonFiles
INFO: File 'C:\Users\chinnsu\RSG\Workspace\API\target\surefire-reports\project.service.json' contains 1 features
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.975 sec <<< FAILURE!
testParallel(project.TestParallel) Time elapsed: 3.92 sec <<< FAILURE!
java.lang.AssertionError: failed features:
project.service: service.feature:22 - null
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at project.TestParallel.testParallel(TestParallel.java:22)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
即使我尝试从一个单独的文件中读取此 json 然后我设置值,但这也不起作用
尝试不设置:
* service.empId = empId
否则这对我有用。请遵循此过程:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue