{"id":16242204,"url":"https://github.com/beetlex-io/webapibenchmark","last_synced_at":"2025-03-16T12:32:48.424Z","repository":{"id":38062583,"uuid":"174525738","full_name":"beetlex-io/WebApiBenchmark","owner":"beetlex-io","description":"Web api management and performance testing tools","archived":false,"fork":false,"pushed_at":"2022-12-08T04:31:35.000Z","size":5877,"stargazers_count":165,"open_issues_count":11,"forks_count":44,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-27T09:12:59.026Z","etag":null,"topics":["beetlex","fasthttpapi","management","performance-testing","testing-tools","web","webapi"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beetlex-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-08T11:27:50.000Z","updated_at":"2024-11-23T01:15:41.000Z","dependencies_parsed_at":"2023-01-24T10:49:11.056Z","dependency_job_id":null,"html_url":"https://github.com/beetlex-io/WebApiBenchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetlex-io%2FWebApiBenchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetlex-io%2FWebApiBenchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetlex-io%2FWebApiBenchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetlex-io%2FWebApiBenchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beetlex-io","download_url":"https://codeload.github.com/beetlex-io/WebApiBenchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814870,"owners_count":20352052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beetlex","fasthttpapi","management","performance-testing","testing-tools","web","webapi"],"created_at":"2024-10-10T14:09:58.252Z","updated_at":"2025-03-16T12:32:48.033Z","avatar_url":"https://github.com/beetlex-io.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web api benchmark\n说到WebApi管理和测试工具其实已经非常多的了，Postman、Swagger等在管理和维护上都非常出色；在性能测试方面也有不少的工具如:wrk,bombardier,http_load和ab等等。不过这些工具都具有单一性，管理和维护好的在性能测试上比较低效，对于性能测试好的在管理和维护上不理想！以下主要介绍一款基于`dotnet core`开发的`WebApiBenchmarks`工具，这个工具可以对webapi进行管理和维护并提供高效的性能测试能力，接下来来先预览一下这个小工具再进行详细介绍。\n### docker\n```\ndocker pull ikende/beetlex_webapi_benchmark:v0.8.6\n```\n```\nhttp://host:9090/\n```\n#### 0.8.2\nheader不进行url编码，非80端口的host添加相应端口\n\n#### 0.7\n添加测试用例名称，优先显示名称；添加返回结果json格式化；添加导出和导入功能；\n\n#### 0.6.8\n\n调整测试用例树刷新问题，添加状态明细查看，修复测试后没有释放连接问题\n\n#### 0.6\n\n添加明细百分比显示\n\n![](https://i.imgur.com/Di9A292.png)\n\n\n## 功能\n-  支持简单的服务管理，可以随时对不同服务的API进行单元和压力测试\n-  支持分类的方式管理测试用例，用例支持定义GET,POST,DELETE和PUT等操作的定义\n-  提供高效的性能测试支持，在4核的PC上可以达到200k rps的测试效能；\n-  支持多API同时压测，并显示相关性能指标数据进行参考和对比\n\n## 部署\n工具可以运行在安装有.net core 2.1或更高版本的Linux和Windows下，工具以http服务的方式启动，通过浏览器访问进行相关操作。\n## 运行\n- linux\n```\ndotnet BeetleX.WebApiBenchmarks.dll\n```\nor\n```\n./webapibenchmark.sh\n```\n\n\n - windows\n ```\n dotnet BeetleX.WebApiBenchmarks.dll\n ```\n or\n ```\n webapibenchmark.bat\n ```\n## 端口冲突\n工具默认使用9090端口，如果端口被占则无法启用服务，这个时候需要修改`HttpConfig.json`文件中的端口配置\n```\n    \"Host\": \"\",\n    \"Port\": 9090,\n    \"SSL\": false,\n```\n## 打开工具\n工具运行后可以浏览器访问相关地址打开工具，本机访问`http://localhost:9090/`其他电脑访问`http://ipaddress:9090/`\n## 添加服务地址\n工具可以维护多个服务地址，所有的测试都必须选择对应的地址才能运行测试。\n\n\n![](https://i.imgur.com/21RxUqG.png)\n\n地址必须是一个可用的http服务Url\n## 添加测试用例\n工具支持GET,POST,DELETE和PUT请求定义，可以根据实际情况定义QueryString和Header值，并针对POST和PUT设置相应的Body内容。具体操作界面如下:\n\n\n![](https://i.imgur.com/uEy21gA.png)\n\n在编辑界面下面有个测试按钮，可以即刻测试API的调用情况；选择相应的服务地址点击测试即可在下方看到完整的返回结果：\n\n\n![](https://i.imgur.com/09D4kOS.png)\n\n\n## 批量单元测试\n工具支持批量执行测试用例，并在测试用例上显示具体的执行结果；只要选择需要测试的用例点击单元测试即可:\n\n\n![](https://i.imgur.com/dLFurrb.png)\n\n## 性能测试\n性能测试是组件提供的最重要功能，为了确保性能测试的效率；组件重写了一个轻量化的HttpClient,通过这个HttpClient即使在低配置的电脑上也可以进行高效率的压力测试。测试前需要选择相应的服务地址和单元测试用例\n\n\n![](https://i.imgur.com/rfEBobs.png)\n\n### 测试参数设置\n工具提供两种测试方式，分别是基于时间和总请求数据，选择对应的测试方式设置相应的测试数值即可；用户数是指同时请求的数量，工具限制设置最大2000，设置完成后点击开始按钮即可进行测试\n\n\n![](https://i.imgur.com/k7yuUeR.png)\n\n### 测试结果\n工具会实时反映测试的情况，主要包括HTTP响应状态和响应延时分布情况，如果同时压测多个API，则明细里会实时显示每个API的响应状态和响应延时情况。具体如下：\n\n![](https://i.imgur.com/vo2iBzO.png)\n![](https://i.imgur.com/EVQvfOb.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeetlex-io%2Fwebapibenchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeetlex-io%2Fwebapibenchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeetlex-io%2Fwebapibenchmark/lists"}