【问题标题】:Karate BDD URL encoding issue空手道 BDD URL 编码问题
【发布时间】:2018-04-03 02:01:10
【问题描述】:

我正在尝试自动化具有特殊字符且资源 URI 为 /products?$select[]=name&$select[]=price

的端点 BestBuy

我还在 maven-surefire-plugin 中添加了 UTF-8 编码的配置,如下 /build/plugins 下

<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 没有找到,并且在错误中得到 ​​p>

信息:(404) 路线:/products%3F$select%5B%5D=name&$select%5B%5D=pbrice - 找不到页面

感谢任何帮助。

【问题讨论】:

    标签: rest karate


    【解决方案1】:

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

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

    张贴,以便对可能面临类似问题的人有所帮助。

    参考网址:Karate Test

    【讨论】:

    • 它说我只能在 2 天后标记自己的答案,将等待 2 天然后标记为答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-14
    • 2010-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多