当前位置: 首页 > 知识库问答 >
问题:

单机版上的空手道框架graphql错误[重复]

方祺
2023-03-14
I have a simple graphql which works well in the maven build but getting error when executed  as a feature file with the standalone karate jar.

这里是请求中使用的图形

getCustomerById.graphqls
-----------------------
query{
    getCustomerById(custid:  "12345"){
    custid
    firstname
    lastname
    address1_text
    address2_text
    city_text
    state_text
    zip_text
}
}
-------------------------

#功能文件graphql。特色

* configure ssl = { keyStore: 'classpath:customer/test.pfx', keyStorePassword: 'test123', keyStoreType: 'pkcs12' }
Given url 'https://<IT_URL>/graphql-data/v1/graphql'
* def customerRequest = read('getCustomerById.graphqls')
And def variables = { customerid: '123456'}
And request { query: '#(query)', variables: '#(variables)' }
When method post
Then status 200

* print 'Response ==>', response

getting the following error
======
18:31:42.699 [main]  WARN  com.intuit.karate.JsonUtils - object to json serialization failure, trying alternate approach: [B cannot be cast to [Ljava.lang.Object;
18:31:42.701 [main]  DEBUG com.intuit.karate - request:
2 > POST https://<ITURL>/graphql-data/v1/graphql
2 > Content-Type: application/json; charset=UTF-8
2 > Content-Length: 62
2 > Host: it-xxx-dns.com
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_291)
2 > Accept-Encoding: gzip,deflate
{"variables":{"customerId":"792798178595168"},"query":"[B@7ca8d498"}

18:31:43.060 [main]  DEBUG com.intuit.karate - response time in milliseconds: 357
2 < 200
2 < Date: Wed, 30 Jun 2021 23:31:42 GMT
2 < Content-Type: application/json;charset=UTF-8
2 < Content-Length: 109
2 < Connection: keep-alive
2 < Access-Control-Allow-Origin: *
2 < Access-Control-Allow-Methods: *
2 < Access-Control-Max-Age: 3600
2 < Access-Control-Allow-Headers: authorization, content-type, xsrf-token
2 < Access-Control-Expose-Headers: xsrf-token
2 < Vary: Origin
2 < Vary: Access-Control-Request-Method
2 < Vary: Access-Control-Request-Headers
2 < Strict-Transport-Security: max-age=15724800; includeSubDomains
2 < Set-Cookie: INGRESSCOOKIE=1625095903.954.332.448531; Domain=it-i3-xxx-dns.com; Secure
{"errors":[{"description":"Invalid Syntax : offending token '[' at line 1 column 1","error_code":"400-900"}]}
18:31:43.061 [main]  INFO  com.intuit.karate - [print] Response ==> {
  "errors": [
    {
      "description": "Invalid Syntax : offending token '[' at line 1 column 1",
      "error_code": "400-900"
    }
  ]
}

======

你能告诉我密码有什么问题吗。是否因为SSL和传递pfx文件,它在独立jar中的行为不同。我不知道,但它在maven构建中运行得非常好

共有1个答案

董琦
2023-03-14

是的,在独立模式下,除非您知道如何正确设置类路径,否则最好使用file:而不是classpath:

请阅读此了解更多信息,并尝试解决这个问题:https://stackoverflow.com/a/58398958/143475

 类似资料:
  • 我95%的自动化框架是在空手道,工作得很好。我们需要检查应用程序日志中显示的中间结果的功能很少(不在Json响应中)。我写了一个外壳脚本,它在从邮递员手动发送请求后验证Linux机器上的应用程序日志。我使用eclipse的JSCH库调用这个脚本。 有没有什么方法可以让我从空手道发送请求,然后调用我的JSCH类进行验证,这样就可以避免手动发送请求的步骤? 谢谢,阿比

  • 我在空手道测试中使用并行执行。我试图在文件夹中生成一个cucumber.json文件。使用当前的设置,我在surefire-reports文件夹中有不同的json和xml文件。有没有一种方法可以生成一个带有特性结果的json文件?

  • 驱动程序:.../src/test/java/root/feature/sanity/smokeTest.java mvn测试输出

  • 我想要帮助验证API响应使用空手道框架。我有相互“独立”的应用编程接口。当我打那个特定的API得到了不同参数的响应(没有单一的匹配从请求参数和响应参数)。 现在我想验证响应参数值。 示例:请求:“方法”帖子 学校名称:“abcd”注册日期:“1:10:2010” 回复:原则名称:“pqrs”原则电子邮件idpqrs@gmail.com 现在我想验证“主名称”不应该为空 我已经像这样实现了,但它不起

  • 我们有Web服务开发使用。NET和一些服务使用basicHttpBinding-和一些使用wsHttpBinding-。 通过使用空手道框架,使用basicHttpBinding的服务可以很好地执行,但不会执行wsHttpBinding。正在获取响应代码415。 通过在SoapUI端执行以下操作,使用wsHttpBind的相同服务在另一个工具(如SoapUI)中执行得很好。 选中启用WS-A寻址

  • 我是银行领域帐户的自动化测试员。我有个问题需要你的帮助。 当前的方法: 1.我们用于API服务测试的框架是使用RESS assured的基于Java的Serenity-Cucumber框架。 2.与该框架相关的所有脚本开发/脚本维护活动都由我们团队中的自动化测试人员负责。 3.几周前,我们了解了空手道框架并完成了PoC(概念验证)。 4.一切顺利,我们正在计划迁移现有的RESS assured J