接口自动化测试持续集成--Soapui接口功能测试数据传递

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

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

1.接口间数据传递

 
  • 解决方法
1.增加测试步骤properties用来存放A接口返回值的数据
 
2.测试步骤properties增加变量
 
3.增加测试步骤Property Transfer
 
4.Property Transfer关联数据到properties
 
5.B接口引用properties存储的A接口的返回值
 

2.TestCase间数据传递

 
  • 解决方法
1.给TestCase-customer_1增加propertis保存返回值
 
2.增加测试步骤Property Transfer
 
3.右键点击测试用例add_contract,新增Run testCase
 

4.TestCase_addcontract引用TestCase-add_customer的返回值
 

猜你喜欢

转载自www.cnblogs.com/lingqiang0605/p/10211098.html