数据库还原脚本: #! /usr/bin/python # coding:utf-8 import time from Engine.SqlEngine import MSSQL COUNT=1 def restoreRelease(): global COUNT checkConSql = "select spid from sysprocesses where dbid in (select dbid from sysdatabases where name='SOATest')"
问题: 在做接口自动化测试的时候,请求报文是json串,但是根据项目规则必须转换成字符串,然后在开头拼接“data=” 接口中很多入参值需要进行参数化. 解决方案: 1.Python并没有对在字符串中简单替换变量值提供直接的支持. 但是通过使用字符串的 format() 方法来解决这个问题.比如: >>> s = 'hello, this is a {param}!' >>> s.format(param='dog') 'hello, this is a dog!' &