我正在测试列出所有品种的公共API。
在回复中,我需要确认“猎犬”品种是否在列表中。我的功能文件如下所示
功能:测试REST API
Scenario: Testing valid GET endpoint
Given url 'https://dog.ceo/api/breeds/list/all'
When method GET
Then status 200
And print response
And match response.message contains 'retriever'
但是我遇到以下错误:
com.intuit.karate.exception.KarateException:路径:$ .message,实际: {affenpinscher = [],african = [],airedale = [],akita = [],appenzeller = [], basenji = [],beagle = [],bluetick = [],borzoi = [],bouvier = [],boxer = [], brabancon = [],briard = [],斗牛犬= [“波士顿”,“法语”], Bullterrier = [“ staffordshire”],cairn = [],牛头犬= [“ australian”], chihuahua = [],chow = [],clumber = [],cockapoo = [],collie = [“ border”], coonhound = [],corgi = [“ cardigan”],cotondetulear = [],dachshund = [], dalmatian = [],dane = [“ great”],deerhound = [“ Scottish”],dhole = [], dingo = [],doberman = [],elkhound = [“挪威”],entlebucher = [], 爱斯基摩人[[],朋友= [“ bichon”],德国牧羊犬= [],灵缇犬[[italian]], groenendael = [], hound = [“ afghan”,“ basset”,“ blood”,“ english”,“ ibizan”,“ walker”], 沙哑= [],基斯洪德= [],凯尔派= [],科蒙多尔= [],库瓦斯= [],拉布拉多= [], 莱昂贝格= [],拉萨= [],阿拉木图= [],玛利诺犬= [],马耳他= [], iff = [“公牛”,“藏族”],mexicanhairless = [],mix = [], 山= [“ bernese”,“瑞士”],纽芬兰= [],水獭= [], papillon = [],pekinese = [],pembroke = [],pincher = [“ miniature”], 指针= [“ german”,“ germanlonghair”],pomeranian = [], poodle = [“微型”,“标准”,“玩具”],pug = [],puggle = [],pyr = [], redbone = [],retriator = [“ chesapeake”,“ curly”,“ flatcoated”,“ golden”], ridgeback = [“ rhodesian”],罗威纳犬= [],saluki = [],萨摩耶= [], schipperke = [],schnauzer = [“ giant”,“ miniature”], setter = [“ english”,“ gordon”,“ irish”],Sheepdog = [“ english”,“ shetland”], shiba = [],shihtzu = [], spaniel = [“ blenheim”,“ brittany”,“ cocker”,“ irish”,“ japanese”,“ sussex”,“ welsh”],springer = [“ english”],stbernard = [], terrier = [“ american”,“ australian”,“ bedlington”,“ border”,“ dandie”,“ fox”,“ irish”,“ kerryblue”,“ lakeland”,“ norfolk”,“ norwich”,“ patterdale” ,“罗素”,“苏格兰”,“ sealyham”,“丝质”,“西藏”,“玩具”,“ westhighland”,“小麦”,“约克郡”]], vizsla = [],weimaraner = [],whippet = [],wolfhound = [“ irish”]},预计: 'retriever',原因:实际值不是字符串
答案 0 :(得分:0)
仔细查看响应结构。这些将起作用:
And match response.message contains { retriever: '#array' }
And match response.message.retriever == ['chesapeake', 'curly', 'flatcoated', 'golden']
请阅读文档和示例。