Soapui接口功能测试数据传递

来源:互联网 发布:m1m2基础货币知乎 编辑:程序博客网 时间:2024/06/05 14:34

转载来自:http://www.jianshu.com/p/b3f66be8fe45


做接口测试经常会遇到如下两种情况需要处理数据传递

  • 接口间的数据依赖,A接口请求的参数需要用到B接口的返回值
  • 接口请求通常要用到鉴权的接口获取Token,Token通常会跟其他接口构成一对多的关系,这种情况下我们可以把Token的接口做成一个公共的TestCase,供其他的TestCase调用

    1.接口间数据传递


    image.png
  • 解决方法
    1.增加测试步骤properties用来存放A接口返回值的数据

    image.png
    2.测试步骤properties增加变量

    image.png
    3.增加测试步骤Property Transfer

    image.png
    4.Property Transfer关联数据到properties

    image.png
    5.B接口引用properties存储的A接口的返回值

    image.png

    2.TestCase间数据传递


    image.png
  • 解决方法
    1.给TestCase-getAccessToken增加propertis保存返回值

    image.png
    2.增加测试步骤Property Transfer并且关联到propertis

    image.png
    3.TestCase-getProductType增加测试步骤Run TestCase调用TestCase-getAccessToken

    image.png
    4.TestCase-getProductType引用TestCase-getAccessToken的返回值


原创粉丝点击