All Projects → zhangfei19841004 → zmock

zhangfei19841004 / zmock

Licence: other
zmock--http接口的mock平台

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to zmock

Smocker
Smocker is a simple and efficient HTTP mock server and proxy.
Stars: ✭ 465 (+374.49%)
Mutual labels:  mock, test, mock-server
Httpmock
HTTP mocking library for Rust.
Stars: ✭ 76 (-22.45%)
Mutual labels:  mock, test, mock-server
main
Mocks Server monorepo
Stars: ✭ 109 (+11.22%)
Mutual labels:  mock, mock-server, test-automation
action-junit-report
Reports junit test results as GitHub Pull Request Check
Stars: ✭ 103 (+5.1%)
Mutual labels:  test, test-automation
xRetry
Retry running tests via Xunit and Specflow
Stars: ✭ 15 (-84.69%)
Mutual labels:  test, test-automation
IO-TESTER
A functional test framework
Stars: ✭ 32 (-67.35%)
Mutual labels:  test, test-automation
open-api-mocker
A mock server based in OpenAPI Specification
Stars: ✭ 58 (-40.82%)
Mutual labels:  mock, mock-server
Example
Example collections of PocoAndroid, Unity3d demo game and etc...
Stars: ✭ 17 (-82.65%)
Mutual labels:  test, test-automation
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-79.59%)
Mutual labels:  test, test-automation
jest-launchdarkly-mock
Easily unit test LaunchDarkly feature flagged components with jest
Stars: ✭ 14 (-85.71%)
Mutual labels:  mock, test
jsxmock
使用 JSX 来定义 Mock Server
Stars: ✭ 31 (-68.37%)
Mutual labels:  mock, mock-server
Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (+11.22%)
Mutual labels:  mock, test
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+117.35%)
Mutual labels:  mock, mock-server
local-data-api
Data API for local, you can write unittest for AWS Aurora Serverless's Data API
Stars: ✭ 99 (+1.02%)
Mutual labels:  mock, test
Telegraf-Test
Telegraf Test - Simple Test ToolKit of Telegram Bots
Stars: ✭ 22 (-77.55%)
Mutual labels:  test, test-automation
any-mock
A configurable mock server,help you mock APIs.
Stars: ✭ 25 (-74.49%)
Mutual labels:  mock, mock-server
stub-server
Stub server for REST APIs
Stars: ✭ 14 (-85.71%)
Mutual labels:  mock, test
BDTest
BDTest - A Testing Framework for .NET
Stars: ✭ 58 (-40.82%)
Mutual labels:  test, test-automation
CodeSpecJS
UI Automation Testing without writing a single line of code
Stars: ✭ 16 (-83.67%)
Mutual labels:  test, test-automation
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+1.02%)
Mutual labels:  mock, test

zmock功能

模拟出一个不存在的http接口,根据请求参数的不同返回对应的数据。

zmock应用场景

  1. 在接口文档写好后,就可以mock出一个接口,以便于客户端开发,且测试人员也可以开始写测试用例。mock出来的接口也相当于一种契约,服务端与客户端都必须遵守这个mock出来的契约。
  2. 当系统中有第三方接口,在做性能测试时,可以mock第三方接口,作为性能测试的档板。
  3. 其它。

zmock介绍

  1. 开发语言及框架:java,spring,easyui
  2. web容器:tomcat
  3. 部署方式:
  • 将打包好的zmock.war更名为ROOT.war
  • 将ROOT.war放在tomcat的webapps目录下面
  • 启动tomcat
  1. 设置

zmock平台使用说明

接口文档: 请求链接:/api/info/v1 请求方法:post 请求参数示例:{"name":"zhang","age":30} 请求参数说明:

参数名 参数类型 是否必需 示例值
name string zhang
age int 30

响应说明:

  1. 当name的值为空或者age的值小于等于0时,响应: {"retCode":"300","retMsg":"参数不正确"}
  2. 当name的值为zhan时,响应: {"retCode":"301","retMsg":"数据不存在"}
  3. 当name值为zhang且age的值为18时,响应: {"retCode":"301","retMsg":"数据不存在"}
  4. 其它情况下,响应: {"retCode":"200","retMsg":"ok.","data":{}}

以上是一份简单的接口文档,公司不同,文档的要求不同,但我相信大家都应该能看懂这份文档,现在,我们根据这份文档来mock一个http接口出来:

  1. 点击左上角的+号:

  1. 确定后,在菜单中选择或输入测试DEMO,在mock请求URL中填写:

  1. mock请求方法选择POST:

  1. 在mock请求参数模板中:

  1. 在mock规则定义中点击新增:

  1. 再增加一条规则:

  1. 最后一条规则:

  1. 保存后,mock就完成了

mock完成后,我们来测试一下这个http接口:

zmock的特点

  1. 请求参数模板的定义。根据请求参数模板,来判断请求参数是否正确。 mock请求参数模板说明:
  • .*表示请求参数为任意字符串,用于POST BODY
  • 如username=&password=表示POST表单提交或GET请求
  • 如{"username":"","password":""}表示POST BODY为JSON串
  1. mock规则利用表达示来定义。比如/name,/age,这是json路径,具体的请参考:https://github.com/zhangfei19841004/zson 表达示所支持的比较符有: == != > >= < <= in contains 表达示方便扩展,如有需要,自行扩展即可。 支持的连接符有:and or (),其中()的优先级最高,支持括号里套括号。
  2. 采用文件异步保存数据的方式,且数据都放在内存里,保证接口的响应速度。
  3. zmock脚本说明
  • zmock脚本采用jexl表达示,具体请参考:jexl官网
  • 内置对象有:headers,params,response

zmock地址

作者联系方式

  • QQ:408129370
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].