将postman数据转换为httprunner的json测试用例。

postman2runner的Python项目详细描述


邮递员

将postman数据转换为httprunner的json测试用例。

用法

查看postman2runner版本:

$ python main.py -V

要查看可用选项,请运行

$ python main.py -h
usage: main.py [-h][-V][--log-level LOG_LEVEL][postman_testset_file][-- output_dir][-- output_file_type]

Convert postman testcases to JSON testcases for HttpRunner.

positional arguments:
  postman_testset_file  Specify postman testset file.
  -- output_dir   Optional. Specify converted JSON testset folder.
  -- output_file_type  Optional. Generate file format , default json.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show version
  --log-level LOG_LEVEL Specify logging level, default is INFO.

示例

在大多数情况下,您可以像这样运行postman2runner

$ python3 main.py tests/data/test.json --output_dir tests/postman2case --output_file_type yaml
INFO:root:Generate JSON testset successfully: output.json

如您所见,第一个参数是postman源文件路径,第二个参数是转换后的json文件路径。

输出测试集文件类型由指定文件的后缀确定。

如果只指定postman源文件路径,则默认情况下输出测试集为json格式,并且位于与源文件相同的文件夹中。

$ python3 main.py tests/data/test.json
INFO:root:Generate JSON testset successfully: test/test.output.json

生成的测试集

生成的json测试集output.json显示如下:

[{"test":{"name":"/api/v1/Account/Login","request":{"method":"POST","url":"https://httprunner.top/api/v1/Account/Login","headers":{"Content-Type":"application/json"},"json":{"UserName":"test001","Pwd":"123","VerCode":""}},"validate":[]}}]

参考来源

[HttpRunner]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在TextView中对齐部分文本   带有iText和eTPKCS11的java PKCS#11签名。dll&SunPKCS11提供程序   java Intellij Idea找不到jar   java Chrome/Firefox和Jetty HTTPS   java我无法打包找不到的JavaFX应用程序模块   多线程Java:排序从异步任务检索的结果   java客户端/服务器socket不能与外部连接一起工作   java如何在单击“下一步”按钮时获取其他详细信息?   java组织。springframework。网状物客户RestTemplate应声明为@Bean,而plain@Autowired抛出错误   java如何绘制javax。摆动将ImageIcon转换为JavaFX。fxml呈现用户界面?   使用for循环的Java跟踪   java如何编码字符串以显示彩色文本(基于字符串中的前缀)   Java保存/打开文件对象   基于java复选框的搜索:使用尽可能多的“”动态生成准备好的语句作为选中复选框的计数   java为什么crawler4j随机挂起?