首页 > 解决方案 > GraphQL 查询中的空手道变量

问题描述

我正在尝试连接到 GraphQL API 端点,但我收到错误消息:

"message": "Validation error of type UnusedVariable: Unused variable password"
"message": "Validation error of type UnusedVariable: Unused variable username"

这是我的代码:

    @first
Feature: check Sign In method by API

  Background: setup
    * url 'https://ffer232311.appsync-api.us-east-1.amazonaws.com/'
    * header Accept = 'application/json'
    * header x-api-key = 'dadsfdsfo4'

  Scenario: get token for certain user
    Given text query =
      """
      mutation signIn ($username: String!, $password: String!) {
    signIn (username: "<username>", password: "<password>") {
        authenticationResult {
            AccessToken
            ExpiresIn
            RefreshToken
            IdToken
        }
        emailVerified
    }
}
      """
    * replace query.username = 'user1'
    * replace query.password = 'pass1'
    Given path 'graphql'
    And request { query: '#(query)' }
    When method post
    Then status 200
    * print 'response:', response

请看一下并指出我的错误在哪里

标签: apigraphqlkarateweb-api-testing

解决方案


推荐阅读