前言 对于Postman中的每个请求,我们都可以使用JavaScript语言来开发测试脚本.这也就好比单元测试.我们先看看Postman的相关界面: 编写测试脚本 Postman测试脚本本质上是在发送请求后执行的JavaScript代码,我们可以通过访问pm.response对象获取服务器返回的报文. 以下是一些测试脚本样例: // example using pm.response.to.have pm.test("response is ok", function () { pm.
在Python的世界里,将一个对象以json格式进行序列化或反序列化一直是一个问题.Python标准库里面提供了json序列化的工具,我们可以简单的用json.dumps来将一个对象序列化.但是这种序列化仅支持python内置的基本类型,对于自定义的类,我们将得到Object of type A is not JSON serializable的错误. 有很多种方法可以用来支持这种序列化,这里有一个很长的关于这个问题的讨论.总结起来,基本上有两种还不错的思路: 利用标准库的接口:从python标