空手道 BDD URL 编码问题

Karate BDD URL encoding issue

我正在尝试自动化具有特殊字符的端点 BestBuy,资源 URI 是 /products?$select[]=name&$select []=价格

我还在/build/plugins

下面的maven-surefire-plugin中添加了UTF-8编码的配置
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                </configuration>
            </plugin>

但是当 运行(通过 IDE 或终端上的 mvn 测试)时出现错误,因为未找到 404,并且在错误中出现

info: (404) Route: /products%3F$select%5B%5D=name&$select%5B%5D=pbrice - Page not found

感谢对此的任何帮助。

我能够通过如下更改测试来修复。

    Given path 'products'
    And param $select[] = 'name'
    And param $select[] = 'price'
    When method get
    Then status 200
    Then print response

发布,这对可能面临类似问题的人有所帮助。

参考URL:Karate Test