npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apipost-runtime

v2.0.5

Published

apipost-runtime 支持单接口http请求、自动化测试

Downloads

143

Readme

🚀 apipost-runtime

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

Install

$ npm install apipost-runtime

Usage

let iterationData = [
    {
        "email": "[email protected]",
        "password": "1234",
        "age": 12
    },
    {
        "email": "[email protected]",
        "password": "1234",
        "age": 11
    },
    {
        "email": "[email protected]",
        "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, // 当前迭代次数
});