1.我希望验证的点:re.search(check_point, resp):
check_point是一段连续的字符时,是可以从resp中匹配到的

当代码量较大时,比如我的case(url和入参都在数据库中保存)
此时与其去修改数据库中的某一个条件,作为 测试 数据,不如直接写一个测试脚本
将想测试的url 和 入参都直接拿出来,快速验证自己的想法



import
requests import re url1 = "xxxxxxxxxxxxxxxxxxx" param1 = { "broom": "1", "buildarea": "0,50", "exchangeneed": "1,4", "heading": "10", "page": "1", "pcount": "15", "price": "0,200", "sqid": "36886", "tag": "16" } r = requests.post(url) resp = r.text check_point='"status":"204","msg":"无数据"' if re.search(check_point, resp): print("123456465") else: print("6666666666666")

 

相关文章:

  • 2022-02-22
  • 2021-05-01
  • 2021-08-07
  • 2021-09-14
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2021-08-28
  • 2021-12-19
  • 2022-02-02
  • 2022-12-23
  • 2021-10-30
  • 2022-02-05
相关资源
相似解决方案