Skip to main content

My short description for my project.

Project description

简介

:waxing_gibbous_moon:几个本质懒到家,却被工作压迫的人。为了降低自己的工作量,拍脑袋决定编写一个让小白也可以使用的测试库。一切的出发点都是几个懒人在实际工作中遇到的问题和场景。做这一切的目的是为了少做事。:waning_gibbous_moon:

功能介绍

接口测试

参数模板 下文的介绍中会使用该模板进行说明 url = "https://test/api/log?requestID=testid&clientToken=testtoken" body ={"date": "2018-11-04 10:10:10", "actions": [{"actionTime": 1542248466944,"note"]}}


接口基础校验


参数值判空校验

链接中的参数校验,即一般情况下GET参数的校验,以requestID为例:

url = "https://test/api/log?requestID=&clientToken=testtoken"

请求主体参数的校验,即一般情况下POST参数的校验,form,raw等参数类型均自动处理。 以body中的date为例,请求参数如下:

body ={"date": "", "actions": [{"actionTime": 1542248466944,"note"]}}

以body中的actions[0][actionTime]为例,请求参数如下:

body ={"date": "2018-11-04 10:10:10", "actions": [{"actionTime": "","note"]}}

空值以空字符串为标准。


参数判空校验

链接中的参数校验,即一般情况下GET参数的校验,以requestID为例:

url = "https://test/api/log?clientToken=testtoken"

请求主体参数的校验,即一般情况下POST参数的校验,form,raw等参数类型均自动处理。 以body中的date为例,请求参数如下:

body ={ "actions": [{"actionTime": 1542248466944,"note"]}}

以body中的actions[0][actionTime]为例,请求参数如下:

body ={"date": "2018-11-04 10:10:10", "actions": [{"note"]}}

参数长度校验

参数长度校验范围为1-100000。


接口性能测试 待添加 UI自动化 功能已实现,说明待添加

安装说明

安装命令pip install BlueTest

or

https://pypi.org/project/BlueTest/

使用说明及范例

范例

└─Project
        test1.py

test1.py:

import BlueTest
BlueTest.test()

└─Project
  test1.py
├─log
      all.log #日志
      error.log #错误日志
├─result #结果
      data.txt
└─srcdata
      test.csv  #postman文件的序列化
      test.json.postman_collection #范例的postman文件
    └─api #根据postman生成的相关接口py文件
            log.py

使用说明

import BlueTest
BlueTest.initPostMan("test") #执行完成会生成相应csv文件
#默认postamen文件路径.//srcdata//name.json.collection
#默认csv文件生成路径.//srcdata//test.csv
BlueTest.testByCsvData("test") #执行完成会生成相应结果
#结果包括 日志文件log 结果文件resul

BlueTest.initPostMan("test") #执行完成会生成相应csv文件
BlueTest.initPostMan("test",result_path=path) #指定csv文件生成路径
BlueTest.testByCsvData("test") #执行完成会生成相应结果
BlueTest.testByCsvData("test",normal_test=True) #进行接口基础验证
BlueTest.testByCsvData("test",normal_test=Fasle) #不进行接口基础验证
BlueTest.testByCsvData("test",mkpy=True) #生成接口py文件范例如下

import requests
url = "https://nbrecsys.4paradigm.com/action/api/log"
querystring = {'requestID': 'Abac6ban', 'clientToken': '1f9d3d10b0ab404e86c2e61a935d3888'}
payload = {"date":"2018-11-04 10:21:06","actions":[{"requestID":"2222","actionTime":1542248466944,"action":"show","sceneId":420,"userId":"xubyCjC6zO","itemId":"user_define","itemSetId":"39","uuid_tt_dd":"10_28867322960-222-222","specialType":"csdn_net_alliance_ads","ads":1}]}
headers ={'Origin': ' https://blog.csdn.net',
	 'User-Agent': ' Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
	 'Content-Type': ' text/plain',
	 'Accept': ' */*',
	 'Referer': ' https://blog.csdn.net/qq_37159430/article/details/79970518',
	 'Accept-Encoding': ' gzip, deflate, br',
	 'Accept-Language': ' zh-CN,zh;q=0.8'}
response = requests.request("POST", url, params=querystring,data=payload,)
print(response.text)

其他功能详见源码 :gun:

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

BlueTest-0.0.8.tar.gz (11.3 kB view details)

Uploaded Source

File details

Details for the file BlueTest-0.0.8.tar.gz.

File metadata

  • Download URL: BlueTest-0.0.8.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for BlueTest-0.0.8.tar.gz
Algorithm Hash digest
SHA256 d2f2ae43de45bca841ac5a0ab278f9851ec261e12a18890eb3777a546f8fda01
MD5 2e9c0090b03de32034f62af43f576471
BLAKE2b-256 324feb5a4cb7c2da03dafa249974272628bef9b4aae99dc8bb85eb6b3756f1e8

See more details on using hashes here.

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