2.0.5 • Published 1 year ago

apipost-runtime v2.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

🚀 apipost-runtime

apipost-runtime 支持单接口http请求、自动化测试。其支持的选项含义可参考下方的demo注释。

Install

$ npm install apipost-runtime

Usage

let iterationData = [
    {
        "email": "1234@qq.com",
        "password": "1234",
        "age": 12
    },
    {
        "email": "1234@qq.com",
        "password": "1234",
        "age": 11
    },
    {
        "email": "1234@qq.com",
        "password": "1234",
        "age": 36
    }
];

let myCollection = new Collection([
    {
        "test_id": "9a017559-967a-4235-898c-5541ffeb7659",
        "event_id": "91e55b90-b79c-43dd-aecd-7c9294cd5b37",
        "type": "api",
        "data": {
            "parent_id": "90de3444-250a-4808-a37f-6715b6add4b1",
            "target_id": "dee9ecb8-b062-4bb2-a694-5edb1c1eaaed",
            "method": "GET",
            "url": "https://2021.apis.cloud/get.php"
        },
        "children": []
    }
], { iterationCount: 4 });
let myRuntime = new Runtime();

myRuntime.run(myCollection.definition, {
    project: {
        request: {
            "header": [
                {
                    "is_checked": "1",
                    "type": "Text",
                    "key": "global-header",
                    "value": "{{age}}",
                    "description": ""
                }
            ],
            "query": [
                {
                    "is_checked": "1",
                    "type": "Text",
                    "key": "",
                    "value": "",
                    "description": ""
                }
            ],
            "body": [
                {
                    "is_checked": "1",
                    "type": "Text",
                    "key": "",
                    "value": "",
                    "description": ""
                }
            ],
            "auth": {
                "type": "noauth",
                "kv": {
                    "key": "",
                    "value": ""
                },
                "bearer": {
                    "key": ""
                },
                "basic": {
                    "username": "",
                    "password": ""
                }
            }
        },
        "script": {
            "pre_script_switch": true,
            "test_switch": true,
            "pre_script": `pm.globals.set("age", '12');`,
            "test": `//apt.assert('response.raw.responseText==\"test\"');`
        }
    }, // 全局参数
    collection: [target1, target2, target3], // 当前流程所需的接口以及父目录集合
    combined_id: 0, // 测试套件ID,单测试用例的话传 0
    test_events: [{
        test_id: 'db5363e4-046a-4ce2-9d6f-89ef0b463026',
        name: '测试计划'
    }], // 测试用例集合,如果是测试套件,此处传数组(单流可以传对象)
    default_report_name: '测试报告',
    user: { // 当前执行的用户信息
        uuid: 'bcad1d6f-7a6c-4a60-a2fc-d59c9ad11d82',
        nick_name: 'Apipost'
    },
    env_name: '默认环境', // 当前环境名称
    env_pre_url: 'http://echo.apipost.cn', // 当前环境URL前缀
    environment: {
        "title": "我是标题"
    }, // 当前环境变量
    globals: {
        "address": "我是地址"
    }, // 当前公共变量
    sleep: 0, // 间隔时间
    iterationData: iterationData, // 当前迭代的excel导入数据
    iterationCount: 4, // 当前迭代次数
});
2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.107

2 years ago

1.1.106

2 years ago

1.1.105

2 years ago

1.1.104

2 years ago

1.1.103

2 years ago

1.1.102

2 years ago

1.1.101

2 years ago

1.1.122

2 years ago

1.1.121

2 years ago

1.1.120

2 years ago

1.1.129

2 years ago

1.1.128

2 years ago

1.1.127

2 years ago

1.1.126

2 years ago

1.1.125

2 years ago

1.1.124

2 years ago

1.1.123

2 years ago

1.1.110

2 years ago

1.1.119

2 years ago

1.1.118

2 years ago

1.1.117

2 years ago

1.1.116

2 years ago

1.1.115

2 years ago

1.1.114

2 years ago

1.1.113

2 years ago

1.1.112

2 years ago

1.1.130

2 years ago

1.1.100

2 years ago

1.1.99

2 years ago

1.1.98

2 years ago

1.1.92

2 years ago

1.1.91

2 years ago

1.1.96

2 years ago

1.1.95

2 years ago

1.1.94

2 years ago

1.1.93

2 years ago

1.1.97

2 years ago

1.1.78

2 years ago

1.1.77

2 years ago

1.1.79

2 years ago

1.1.90

2 years ago

1.1.76

2 years ago

1.1.75

2 years ago

1.1.70

2 years ago

1.1.74

2 years ago

1.1.73

2 years ago

1.1.72

2 years ago

1.1.71

2 years ago

1.1.69

2 years ago

1.1.68

2 years ago

1.1.63

3 years ago

1.1.67

2 years ago

1.1.66

2 years ago

1.1.65

2 years ago

1.1.64

2 years ago

1.1.52

3 years ago

1.1.56

3 years ago

1.1.55

3 years ago

1.1.54

3 years ago

1.1.59

3 years ago

1.1.58

3 years ago

1.1.57

3 years ago

1.1.61

3 years ago

1.1.60

3 years ago

1.1.50

3 years ago

1.1.49

3 years ago

1.1.48

3 years ago

1.1.47

3 years ago

1.1.46

3 years ago

1.1.45

3 years ago

1.1.44

3 years ago

1.1.43

3 years ago

1.1.42

3 years ago

1.1.41

3 years ago

1.1.40

3 years ago

1.1.38

3 years ago

1.1.37

3 years ago

1.1.36

3 years ago

1.1.35

3 years ago

1.1.34

3 years ago

1.1.33

3 years ago

1.1.32

3 years ago

1.1.31

3 years ago

1.1.30

3 years ago

1.1.29

3 years ago

1.1.28

3 years ago

1.1.27

3 years ago

1.1.26

3 years ago

1.1.25

3 years ago

1.1.24

3 years ago

1.1.23

3 years ago

1.1.22

3 years ago

1.1.21

3 years ago

1.1.20

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.16

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.7

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago