在 Jenkins 中使用 newman 命令上传多个 files/images

Upload multiple files/images using newman command in Jenkins

运行 一名邮递员 API 使用 Newman 命令,目前上传单个文件。我的要求是使用相同的 API.

上传多个文件

我当前上传单个文件的代码如下所示:-

"method": "POST",
                    "header": [],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "file",
                                "description": "Jpeg image or video (mov or mp4)",
                                "type": "file",
                                "src": "C:\Test\abc.jpeg"
                            }

                        ]
                    }

在这段完全相同的代码中,我想上传多个文件。 需要一些关于如何实现它的指导。

我 post 通过发送多个 POST 请求在 postman/newman 中创建多个文件 - 每个请求一个文件。 因此,您可以发送多个文件来执行一个 postman 请求集合。

编辑: 具有 2 个文件字段的表单示例:

"method": "POST",
                "header": [],
                "body": {
                    "mode": "formdata",
                    "formdata": [
                        {
                            "key": "myFile1",
                            "description": "Jpeg image or video (mov or mp4)",
                            "type": "file",
                            "src": "C:\Test\abc.jpeg"
                        },
                        {
                            "key": "myFile2",
                            "description": "Jpeg image or video (mov or mp4)",
                            "type": "file",
                            "src": "C:\Test\def.jpeg"
                        }

                    ]
                }