空手道SET功能没有设置值

问题描述 投票:-1回答:1

在给定的代码中,我想更新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,然后我设置了值,但也没有用。

bdd karate
1个回答
1
投票

试试没有设置。

* service.empId = empId

Else这对我来说是可行的 请按照这个过程。https:/github.comintuitkaratewiki如何提交一个问题。

© www.soinside.com 2019 - 2024. All rights reserved.