测试开发精英班,通向高级软件测试工程师【周活动】 找茬--心里圈的故事 !【长期招募】博为峰网校招聘兼职讲师!横扫BAT,Python全栈测试开发技能大全
【106期】:如何树立正确使用Python做开发的习惯 【征稿】提交你的测试成绩单! 【专题】用尽一切办法只为让你学好用例 自学软件测试那点事
查看: 1831|回复: 0

【推荐原文】How to Extract Values When Spring Boot API Testing With REST Assured

  • TA的每日心情
    2019-2-2 13:49
  • 签到天数: 242 天

    连续签到: 1 天


    发表于 2017-8-16 14:52:57 | 显示全部楼层 |阅读模式
    原文作者:Grigor Avagyan

    The ability to extract values and use them in the following subsequent request is an important ability in modern API Testing solutions. In this blog post I will show you how to extract and assert these values, by using Java, Gradle, Intellij and REST Assured.

    Intellij is an integrated development environment, REST Assured is an open-source framework for testing REST services in Java, and Gradle is a Build tool. You can choose different tools for this kind of testing. It all depends on your preferences and taste, and of course which kind of project you are testing.

    For demo testing, I created a small API with Java / Spring Boot and Hibernate. The API has 4 Controllers - Arrival, Departure, Users and Flight. Each of them has 2 or more endpoints/paths for calling by different types of request. Most of them are GET, but there are also POST and DELETE requests in some paths. You can run this test yourself, from here.

    The testing shown here will cover all simple areas for endpoints testing, e.g. schema validation of JSON response, request time, allowed methods and etc. Unit testing is not included.

    Step 1 - Create a API Testing Project

    1. Install IntelliJ IDEA

    2. Make sure you have JDK installed (at least version 1.8.XXX).

    Now we will create a new project.

    3. Open IntelliJ and click “Create New Project”


    ① 发送一段试译内容到我们的邮箱 editor@51testing.com,通过后即可翻译
    ② 加小编 QQ:1718403480,备注:翻译试译

    ① 翻译文章经过评审入选后,即可发布在《51测试天地》电子刊物中,并有相应稿费支付!还有机会上网站头条,得到大力宣传!
    ② 未入选文章,也可以获得博为峰网校10元代金券



    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing


    使用道具 举报



    站长推荐上一条 /2 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2019-9-21 00:53 , Processed in 0.059517 second(s), 24 queries .

    Powered by Discuz! X3.2

    © 2001-2019 Comsenz Inc.

    快速回复 返回顶部 返回列表