Skip to main content

graphql & restful / http(s) tools

Project description

前置

  1. 安装allure并配置好环境变量
  2. 项目根目录新建 hooks.py 实现动态扩展函数
  3. 编写测试文件代码
  4. 执行测试

作用

graphql, restful HTTP/HTTPS 接口测试工具,需要编写代码

example

# testcase.py

from gruntest.grunner import Grunner
from gruntest.schemas import Config, TestStep, RequestSchema


class TestRunner(Grunner):
    config = Config(
        base_header={"Host": "49.232.203.244:1339"}
    )
    steps = [
        TestStep(
            name='百度',
            request=RequestSchema(
                url='http://www.httpbin.org/get',
                method='get',
                headers={"token": "123"},
                params={"limit": 5, "page": 1}
            ),
            extra={"code": "$.args.limit"}
        ),
        TestStep(
            name='百度',
            request=RequestSchema(
                url='http://www.httpbin.org/get',
                method='get',
                headers={"token": "123"},
                params={"limit": 5, "page": "${sum2('$code')}"}
            ),
            extra={"code": "$.args.limit"},
            expect={"$.code": "code"}
        )
    ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gruntest-0.1.1.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

gruntest-0.1.1-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page