<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>API Testing</title><link>https://linuxsuren.github.io/api-testing/</link><description>Recent content on API Testing</description><generator>Hugo</generator><language>zh-cn</language><atom:link href="https://linuxsuren.github.io/api-testing/index.xml" rel="self" type="application/rss+xml"/><item><title>本地安装</title><link>https://linuxsuren.github.io/api-testing/latest/install/install-local/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/install/install-local/</guid><description>&lt;h2 id="手动下载">手动下载&lt;/h2>
&lt;p>您可以通过下面的链接下载最新版本的安装包：&lt;/p>
&lt;p>&lt;a href="https://github.com/LinuxSuRen/api-testing/releases/latest">&lt;img src="https://img.shields.io/github/v/release/linuxsuren/api-testing" alt="GitHub Release">&lt;/a>&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Package&lt;/th>
 &lt;th>GitHub&lt;/th>
 &lt;th>Mirror from DaoCloud&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>atest-desktop.msi&lt;/code>&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/api-testing/releases/latest/download/atest-desktop.msi">link&lt;/a>&lt;/td>
 &lt;td>&lt;a href="https://files.m.daocloud.io/github.com/LinuxSuRen/api-testing/releases/latest/download/atest-desktop.msi">link&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>atest-linux-amd64.tar.gz&lt;/code>&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/api-testing/releases/latest/download/atest-linux-amd64.tar.gz">link&lt;/a>&lt;/td>
 &lt;td>&lt;a href="https://files.m.daocloud.io/github.com/LinuxSuRen/api-testing/releases/latest/download/atest-linux-amd64.tar.gz">link&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>atest-darwin-amd64.tar.gz&lt;/code>&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/api-testing/releases/latest/download/atest-darwin-amd64.tar.gz">link&lt;/a>&lt;/td>
 &lt;td>&lt;a href="https://files.m.daocloud.io/github.com/LinuxSuRen/api-testing/releases/latest/download/atest-darwin-amd64.tar.gz">link&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="通过工具下载">通过工具下载&lt;/h2>
&lt;p>&lt;a href="https://github.com/LinuxSuRen/http-downloader">hd&lt;/a> 是一个支持多线程下载的工具：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>hd i atest
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>很荣幸与屈晗煜在 GitLink 编程夏令营（GLCC）活动中协作</title><link>https://linuxsuren.github.io/api-testing/news/blogs/glcc-2023-announce/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/news/blogs/glcc-2023-announce/</guid><description>&lt;p>很荣幸与屈晗煜在 GitLink 编程夏令营（GLCC）活动中协作&lt;/p>
&lt;p>作为一名软件工程师，天然有着追求代码质量的执念。相信很多人对代码的优雅、质量有着自己的认识，业界也有不少的共识，其中有一条我认为是非常重要的——代码可测试。&lt;/p>
&lt;p>作为一名研发，只关注功能可测（容易测）是远远不够的。从严谨的角度来看，我们每提交一个 PR（泛指有新的代码准备如何主分支）时，需要提供你已经测试通过的“证据”。
仅仅基于对团队成员的信任（或 QA 人员的回归测试）是很难从软件工程角度来保障代码质量的。研发 leader（或 QA）在面对 PR 时，可能会问到：你的代码自测过了吗？
这也许是一个毫无意义的提问——可能很大一部分人会出于面子考虑直接回答”测过了“，另外一些诚实的人会说”忘记了“。在我看来，我们需要避免类似的无效、低效沟通；
既然都是研发，那为什么不用测试代码来证明你的逻辑（或业务）代码的正确性呢？&lt;/p>
&lt;p>单元测试、接口测试，是两种非常有效的、相对低成本的方法，前者可以确保函数的逻辑正确，后者可以确保 API 总是按照既定的输入和输出格式来处理。对于后端研发来说，
能把这两种方法用起来的话，低级的、关联性的 bug 已经很难再流入到代码仓库的主干分支中了。&lt;a href="https://github.com/LinuxSuRen/api-testing">API Testing&lt;/a> 项目
的发起，主要是为了持续提高我自己的代码质量，并且希望能帮助到有需要的其他人（研发或测试）。这个项目提供了诸如：命令行、CICD、VS-Code、浏览器等场景对接口测试的需求，
目标是在尽量不改变已有研发习惯的前提下，使得大家可以便捷、简单地借助接口测试提高自己的代码质量。文中多次提到代码质量，本项目的后端 Golang 部分的单元测试
覆盖率目前为 94%，之后也会持续提高测试覆盖率（包括前端等代码的）。&lt;/p>
&lt;p>几周前，了解到 &lt;a href="https://www.gitlink.org.cn/glcc">GLCC&lt;/a> 这个活动还在招募开源项目。于是尝试联系官方负责人，咨询是否接受个人发起的开源项目（而且
还是一个处在早期阶段的项目，截止本文只有 77 次 commit）。另外我感到惊喜和意外的是，这个项目不仅受到官方的认可与资助（完成项目议题的同学可以得到 6000 元奖励），
而且还有 5 位同学对这个项目表示感兴趣，收到 4 份申请书。之后，我分别从多个维度尝试选择与项目匹配的申请人：是否在本项目中提交过 PR 或 issue、是否有邮件等
沟通、议题设计、示例代码或 POC、GitHub 是否活跃、时间安排是否充足等（前面每一项的权重略有不同）。要知道，大部分同学都已经通过邮件和我进行了多次沟通，
而且有两位同学也分别提交过 PR、issue，放弃任何一位申请人都是于心不忍的，因而我也尽量以相对客观的方式来做出选择。&lt;/p>
&lt;p>让我印象比较深刻的是，屈晗煜 (&lt;a href="https://github.com/Ink-33">Ink-33&lt;/a>) 同学在申请书中给出了他对 gPRC 的一些调研结果，以及如何实现 gRPC 接口测试的大致思路，甚至还有一些实验性的代码。另外，他虽然只是大一新生，但编码经验却不少；能看得出来他确实是对编程很感兴趣。&lt;/p>
&lt;p>最后，希望其他几位同学能匹配到其他项目，并能在参与开源的过程中有所收获。&lt;/p>
&lt;p>本文相关链接：&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/Ink-33">https://github.com/Ink-33&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/LinuxSuRen/api-testing/issues/81">https://github.com/LinuxSuRen/api-testing/issues/81&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.gitlink.org.cn/glcc/2023/subjects/detail/656">https://www.gitlink.org.cn/glcc/2023/subjects/detail/656&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.gitlink.org.cn/linuxsuren/api-testing/issues/1">https://www.gitlink.org.cn/linuxsuren/api-testing/issues/1&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Helm</title><link>https://linuxsuren.github.io/api-testing/latest/install/install-helm/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/install/install-helm/</guid><description>&lt;p>You could install &lt;code>api-testing&lt;/code> via Helm chart:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>helm install atest oci://docker.io/linuxsuren/api-testing &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --version v0.0.2-helm &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set service.type&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>NodePort
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or upgrade it:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>helm upgrade atest oci://docker.io/surenpi/api-testing &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --version v0.0.2-helm &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set image.tag&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>master &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set &lt;span style="color:#000">replicaCount&lt;/span>&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">3&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="skywalking">SkyWalking&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>helm install atest oci://docker.io/linuxsuren/api-testing &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --version v0.0.2-helm &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set image.tag&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>master &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set service.type&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>NodePort &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set service.nodePort&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">30154&lt;/span> &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set skywalking.endpoint.http&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>http://skywalking-skywalking-helm-oap.skywalking.svc:12800 &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --set skywalking.endpoint.grpc&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>skywalking-skywalking-helm-oap.skywalking.svc:11800
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>安全策略</title><link>https://linuxsuren.github.io/api-testing/contributions/design/security-policy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/contributions/design/security-policy/</guid><description>&lt;p>// TBD&lt;/p></description></item><item><title>发展规划</title><link>https://linuxsuren.github.io/api-testing/contributions/roadmap/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/contributions/roadmap/</guid><description>&lt;p>// TBD&lt;/p></description></item><item><title>贡献指南</title><link>https://linuxsuren.github.io/api-testing/contributions/contributing-zh/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/contributions/contributing-zh/</guid><description>&lt;p>请加入我们，共同完善这个项目。&lt;/p>
&lt;p>后端由 &lt;a href="https://go.dev/">Golang&lt;/a> 编写，前端由 &lt;a href="https://vuejs.org/">Vue&lt;/a> 编写。&lt;/p>
&lt;h3 id="对于初学者">对于初学者&lt;/h3>
&lt;p>在开始之前，您可能需要了解以下技术:&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Name&lt;/th>
 &lt;th>Domain&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview">HTTP&lt;/a> Protocol&lt;/td>
 &lt;td>Core&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://en.wikipedia.org/wiki/REST">RESTful&lt;/a>&lt;/td>
 &lt;td>Core&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://grpc.io/">gRPC&lt;/a>&lt;/td>
 &lt;td>&lt;code>gRPC&lt;/code> runner extension&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://prometheus.io/">Prometheus&lt;/a>&lt;/td>
 &lt;td>Application monitor&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://github.com/spf13/cobra">Cobra&lt;/a>&lt;/td>
 &lt;td>The Go CLI framework&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://element-plus.org/">Element Plus&lt;/a>&lt;/td>
 &lt;td>The front-end framework&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://www.docker.com/get-started/">Docker&lt;/a>&lt;/td>
 &lt;td>The container image build&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://helm.sh/">Helm chart&lt;/a>&lt;/td>
 &lt;td>The &lt;a href="https://kubernetes.io/docs/home/">Kubernetes&lt;/a> application package&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://docs.github.com/en/actions">GitHub Actions&lt;/a>&lt;/td>
 &lt;td>The continuous integration&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://www.gnu.org/software/make/">make&lt;/a>&lt;/td>
 &lt;td>The automated Build Tools&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/api-testing.git">Docs Guide&lt;/a>&lt;/td>
 &lt;td>文档编写指南&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="设置开发环境">设置开发环境&lt;/h2>
&lt;blockquote>
&lt;p>本项目使用 &lt;code>make&lt;/code> 作为构建工具，并设计了非常强大的 make 指令系统。您可以通过运行 &lt;code>make help&lt;/code> 查看所有可用的命令。&lt;/p>&lt;/blockquote>
&lt;p>强烈建议您配置 &lt;code>git pre-commit&lt;/code> 钩子。它会强制在提交前运行单元测试。
运行以下命令：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>make install-precheck
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="打印各行代码">打印各行代码：&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>git ls-files &lt;span style="color:#000;font-weight:bold">|&lt;/span> xargs cloc
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="pprof">pprof&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>go tool pprof -http&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>:9999 http://localhost:8080/debug/pprof/heap
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>其他用法：&lt;/p></description></item><item><title>目标</title><link>https://linuxsuren.github.io/api-testing/contributions/design/goals/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/contributions/design/goals/</guid><description>&lt;p>// TBD&lt;/p></description></item><item><title>快速入门</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/quickstart/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/quickstart/</guid><description>&lt;p>本指南将帮助您通过几个简单的步骤开始使用 API Testing。&lt;/p>
&lt;h2 id="执行部分测试用例">执行部分测试用例&lt;/h2>
&lt;p>下面的命令会执行名称中包含 &lt;code>sbom&lt;/code> 的所有测试用例：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>atest run -p test-suite.yaml --case-filter sbom
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="json-schema">JSON Schema&lt;/h2>
&lt;p>您可以访问下面 &lt;code>atest&lt;/code> 的 JSON Schema 来了解测试用例的编写规范：&lt;/p>
&lt;p>&lt;a href="https://linuxsuren.github.io/api-testing/api-testing-schema.json">https://linuxsuren.github.io/api-testing/api-testing-schema.json&lt;/a>&lt;/p></description></item><item><title>关于安全</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/secure/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/secure/</guid><description>&lt;p>通常在不使用 TLS 证书认证时，gRPC 客户端与服务端之间进行的是明文通信，信息易被第三方监听或篡改。所以大多数情况下均推荐使用 SSL/TLS 保护 gRPC 服务。目前&lt;code>atest&lt;/code>已实现服务端 TLS，双向 TLS(mTLS) 需等待后续实现。&lt;/p>
&lt;p>默认情况下&lt;code>atest&lt;/code>不使用任何安全策略，等价于&lt;code>spec.secure.insecure = true&lt;/code>。启用 TLS 仅需 yaml 中添加以下内容：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">spec&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">secure&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">cert&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">server.pem&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">serverName&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">atest&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="字段说明">字段说明&lt;/h2>
&lt;p>&lt;code>secure&lt;/code>共有以下五个字段：&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>字段名&lt;/th>
 &lt;th>类型&lt;/th>
 &lt;th>是否可选&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>cert&lt;/td>
 &lt;td>string&lt;/td>
 &lt;td>x&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>ca&lt;/td>
 &lt;td>string&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>key&lt;/td>
 &lt;td>string&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>serverName&lt;/td>
 &lt;td>string&lt;/td>
 &lt;td>x&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>insecure&lt;/td>
 &lt;td>bool&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;p>&lt;code>cert&lt;/code>为客户端需要配置的证书的文件路径，格式为&lt;code>PEM&lt;/code>。&lt;/p>
&lt;p>&lt;code>serverName&lt;/code>为 TLS 所需的服务名，通常为签发证书时使用的 x509 SAN。&lt;/p>
&lt;p>&lt;code>ca&lt;/code>为 CA 证书的路径，&lt;code>key&lt;/code>为与&lt;code>cert&lt;/code>对应的私钥，这两项填写后代表启用 mTLS。(mTLS 尚未实现)&lt;/p>
&lt;p>当&lt;code>insecure&lt;/code>为&lt;code>false&lt;/code>时，&lt;code>cert&lt;/code>和&lt;code>serverName&lt;/code>为必填项。&lt;/p></description></item><item><title>用例模板</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/template/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/template/</guid><description>&lt;p>&lt;code>atest&lt;/code> 采用 &lt;a href="https://masterminds.github.io/sprig/">sprig&lt;/a> 作为测试用例的模板引擎。通过模板函数可以生成很多随机数据：&lt;/p>
&lt;h2 id="手机号">手机号&lt;/h2>
&lt;p>下面的代码可以生成 &lt;code>182&lt;/code> 开头的手机号：&lt;/p>
&lt;pre tabindex="0">&lt;code>182{{shuffle &amp;#34;09876543&amp;#34;}}
&lt;/code>&lt;/pre>&lt;h2 id="带权重的随机枚举">带权重的随机枚举&lt;/h2>
&lt;p>下面的代码以 80% 的概率返回 &lt;code>open&lt;/code>，以 20% 的概率返回 &lt;code>closed&lt;/code>：&lt;/p>
&lt;pre tabindex="0">&lt;code>{{randWeightEnum (weightObject 4 &amp;#34;open&amp;#34;) (weightObject 1 &amp;#34;closed&amp;#34;)}}
&lt;/code>&lt;/pre>&lt;h2 id="时间">时间&lt;/h2>
&lt;p>下面的代码可以生成当前时间，并制定时间格式：&lt;/p>
&lt;pre tabindex="0">&lt;code>{{ now.Format &amp;#34;2006-01-02T15:04:05Z07:00&amp;#34; }}
&lt;/code>&lt;/pre>&lt;p>如果想要获取其他时间，则可以参考如下写法：&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-gotemplate" data-lang="gotemplate">{{(now | date_modify &amp;#34;2h&amp;#34;) | date &amp;#34;2006-01-02T15:04:05&amp;#34;}}
&lt;/code>&lt;/pre>&lt;h2 id="环境变量">环境变量&lt;/h2>
&lt;p>下面的代码可以获取环境变量 &lt;code>SHELL&lt;/code> 的值，在需要使用一个全局变量的时候，可以使用这个模板函数：&lt;/p>
&lt;pre tabindex="0">&lt;code>{{ env &amp;#34;SHELL&amp;#34; }}
&lt;/code>&lt;/pre></description></item><item><title>任务</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/job/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/job/</guid><description>&lt;p>在特定情况下，执行接口测试用例前需要执行相应的任务，例如：数据初始化、等待服务就绪等等。 &lt;code>atest&lt;/code> 的任务功能，就是为了满足这类场景而设计的。&lt;/p>
&lt;blockquote>
&lt;p>任务的执行引擎为 &lt;a href="https://expr.medv.io">expr&lt;/a>，如果当前页面给出的示例无法满足你的需求，可以查阅相关的官方文档。&lt;/p>&lt;/blockquote>
&lt;h2 id="等待接口响应码为-200">等待接口响应码为 200&lt;/h2>
&lt;p>以下的例子会每隔一秒请求一次指定的接口，并检查响应码（Status Code）是否为 200，如果不是的话，则最多会重试 3 次：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">demo&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">http://localhost&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">items&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">login&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">before&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">items&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#000">httpReady(&amp;#34;http://localhost/health&amp;#34;, 3)&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">request&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">/demo&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>如果希望检查响应体的话，则可以用下面的表达式：&lt;/p>
&lt;pre tabindex="0">&lt;code>httpReady(&amp;#34;http://localhost:17001/actuator/health&amp;#34;, 3, &amp;#39;components.discoveryComposite.components.eureka.details.applications[&amp;#34;AUTH&amp;#34;] == 1&amp;#39;)
&lt;/code>&lt;/pre></description></item><item><title>测试用例验证</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/verify/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/verify/</guid><description>&lt;p>&lt;code>atest&lt;/code> 采用 &lt;a href="https://expr.medv.io">https://expr.medv.io&lt;/a> 对 HTTP 请求响应的验证，比如：返回的数据列表长度验证、具体值的验证等等。下面给出一些例子：&lt;/p>
&lt;blockquote>
&lt;p>需要注意的是，&lt;code>data&lt;/code> 指的是 HTTP Response Body（响应体）的 JSON 对象。&lt;/p>&lt;/blockquote>
&lt;h2 id="数组长度判断">数组长度判断&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">projectKinds&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">request&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">/api/resources/projectKinds&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">expect&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">verify&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#000">len(data.data) == 6&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="数组值检查">数组值检查&lt;/h2>
&lt;h3 id="检查数组中是否有元素的字段包含特定值">检查数组中是否有元素的字段包含特定值&lt;/h3>
&lt;p>示例数据：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-json" data-lang="json">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000;font-weight:bold">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#204a87;font-weight:bold">&amp;#34;data&amp;#34;&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span> &lt;span style="color:#000;font-weight:bold">[{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#204a87;font-weight:bold">&amp;#34;key&amp;#34;&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span> &lt;span style="color:#4e9a06">&amp;#34;Content-Type&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">}]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000;font-weight:bold">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>校验配置：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">popularHeaders&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">request&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">/popularHeaders&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">expect&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">verify&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#000">any(data.data, {.key == &amp;#34;Content-Type&amp;#34;})&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="检查数组中是否有元素的字段只包含特定值">检查数组中是否有元素的字段只包含特定值&lt;/h3>
&lt;p>校验配置：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">popularHeaders&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">request&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">/popularHeaders&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">expect&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">verify&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#000">all(data.data, {.key == &amp;#34;Content-Type&amp;#34; or .key == &amp;#34;Target&amp;#34;})&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;a href="https://expr-lang.org/docs/language-definition#any">更多用法&lt;/a>.&lt;/p></description></item><item><title>End-to-End</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/e2e/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/e2e/</guid><description>&lt;p>&lt;code>atest&lt;/code> 非常适合针对（HTTP）接口做 E2E（端到端）测试，E2E 测试可以确保后端接口在完整的环境中持续地保持正确运行。下面采用 Docker compose 给出一个使用事例：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">version&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#39;3.1&amp;#39;&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">services&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">testing&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">image&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">ghcr.io/linuxsuren/api-testing:latest&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">environment&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">SERVER&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">http://server:8080&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">volumes&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#000">./testsuite.yaml:/work/testsuite.yaml&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">command&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">atest run -p /work/testsuite.yaml&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">depends_on&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">server&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">condition&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">service_healthy&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">links&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#000">server&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">server&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">image&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">ghcr.io/devops-ws/learn-springboot:master&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">healthcheck&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">test&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000;font-weight:bold">[&lt;/span>&lt;span style="color:#4e9a06">&amp;#34;CMD&amp;#34;&lt;/span>&lt;span style="color:#000;font-weight:bold">,&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;bash&amp;#34;&lt;/span>&lt;span style="color:#000;font-weight:bold">,&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;-c&amp;#34;&lt;/span>&lt;span style="color:#000;font-weight:bold">,&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#4e9a06">&amp;#34;cat &amp;lt; /dev/null &amp;gt; /dev/tcp/127.0.0.1/8080&amp;#34;&lt;/span>&lt;span style="color:#000;font-weight:bold">]&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">interval&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">3s&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">timeout&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">60s&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">retries&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#0000cf;font-weight:bold">10&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">start_period&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">3s&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>从 Docker compose &lt;code>v2.36.0&lt;/code> 开始，可以采用如下简化的写法：&lt;/p></description></item><item><title>Mock 服务</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/mock/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/mock/</guid><description>&lt;p>Mock 服务在前后端并行开发、系统对接、设备对接场景下能起到非常好的作用，可以极大地降低团队之间、系统之间的耦合度。&lt;/p>
&lt;p>用户可以通过命令行终端（CLI）、Web UI 的方式来使用 Mock 服务。&lt;/p>
&lt;h2 id="命令行">命令行&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>atest mock --prefix / --port &lt;span style="color:#0000cf;font-weight:bold">9090&lt;/span> mock.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="web">Web&lt;/h2>
&lt;p>在 UI 上可以实现和命令行相同的功能，并可以通过页面编辑的方式修改、加载 Mock 服务配置。&lt;/p>
&lt;h2 id="mock-docker-registry">Mock Docker Registry&lt;/h2>
&lt;p>您可以通过执行下面的命令 mock 一个容器仓库服务&lt;a href="https://distribution.github.io/distribution/">container registry&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>atest mock --prefix / mock/image-registry.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>之后，您可以通过使用如下的命令使用 mock 功能。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker pull localhost:6060/repo/name:tag
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="语法">语法&lt;/h2>
&lt;p>从整体上来看，我们的写法和 HTTP 的名称基本保持一致，用户无需再了解额外的名词。此外，提供两种描述 Mock 服务的方式：&lt;/p>
&lt;ul>
&lt;li>面向对象的 CRUD&lt;/li>
&lt;li>自定义 HTTP 服务&lt;/li>
&lt;/ul>
&lt;h3 id="面向对象">面向对象&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic">#!api-testing-mock&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#8f5902;font-style:italic"># yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-mock-schema.json&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">objects&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">projects&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">initCount&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#0000cf;font-weight:bold">3&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">sample&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000;font-weight:bold">|&lt;/span>&lt;span style="color:#8f5902;font-style:italic">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> {
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;name&amp;#34;: &amp;#34;atest&amp;#34;,
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;color&amp;#34;: &amp;#34;{{ randEnum &amp;#34;blue&amp;#34; &amp;#34;read&amp;#34; &amp;#34;pink&amp;#34; }}&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> }&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>上面 &lt;code>projects&lt;/code> 的配置，会自动提供该对象的 CRUD（创建、查找、更新、删除）的 API，你可以通过 &lt;code>atest&lt;/code> 或类似工具发出 HTTP 请求。例如：&lt;/p></description></item><item><title>代码生成</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/code-generator/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/code-generator/</guid><description>&lt;p>&lt;code>atest&lt;/code> 支持把测试用例生成多种开发语言的代码：&lt;/p>
&lt;ul>
&lt;li>curl&lt;/li>
&lt;li>Java&lt;/li>
&lt;li>Golang&lt;/li>
&lt;li>Python&lt;/li>
&lt;li>JavaScript&lt;/li>
&lt;li>&lt;a href="https://robotframework.org/">Robot Framework&lt;/a>&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>该功能需要在 Web UI 上使用。&lt;/p>&lt;/blockquote></description></item><item><title>gRPC测试用例编写指南</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/grpc-manual/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/grpc-manual/</guid><description>&lt;p>本文档将介绍如何编写&lt;code>api-testing&lt;/code>的 gRPC API 的测试用例。&lt;/p>
&lt;p>阅读本文档之前，您需要先安装并配置好&lt;code>api-testing&lt;/code>，具体操作可以参考&lt;a href="https://linuxsuren.github.io/api-testing/latest/install/">安装&lt;/a>章节。如果您已经完成了这些步骤，可以继续阅读本文档的后续部分。&lt;/p>
&lt;h2 id="创建测试项目">创建测试项目&lt;/h2>
&lt;p>创建一个基于服务反射的 gRPC 测试用例仅需在 yaml 文件的&lt;code>spec&lt;/code>路径下加入以下内容：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">spec&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">rpc&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">serverReflection&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">true&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>rpc&lt;/code>字段一共有五个子字段&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>字段名&lt;/th>
 &lt;th>类型&lt;/th>
 &lt;th>是否可选&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>import&lt;/td>
 &lt;td>[]string&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>protofile&lt;/td>
 &lt;td>string&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>protoset&lt;/td>
 &lt;td>string&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>serverReflection&lt;/td>
 &lt;td>bool&lt;/td>
 &lt;td>√&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h3 id="字段import和protofile">字段&lt;code>import&lt;/code>和&lt;code>protofile&lt;/code>&lt;/h3>
&lt;p>&lt;code>protofile&lt;/code>是一个文件路径，指向&lt;code>api-testing&lt;/code>查找描述符的&lt;code>.proto&lt;/code>文件的位置。&lt;/p>
&lt;p>&lt;code>import&lt;/code>字段与&lt;code>protc&lt;/code>编译器中的&lt;code>--import_path&lt;/code>参数类似，用于确定查找&lt;code>proto&lt;/code>文件的位置与解析依赖的目录。与&lt;code>protoc&lt;/code>一样，您不需要在此处指定某些&lt;code>proto&lt;/code>文件的位置（以&lt;code>google.protobuf&lt;/code>开头的&lt;code>Protocol Buffers Well-Known Types&lt;/code>），它们已经内置在了&lt;code>api-testing&lt;/code>中。&lt;/p>
&lt;h3 id="字段protoset">字段&lt;code>protoset&lt;/code>&lt;/h3>
&lt;p>&lt;code>protoset&lt;/code>字段既可以是一个文件路径，也可以是&lt;code>http(s)://&lt;/code>开头的网络地址。&lt;/p>
&lt;p>当您的&lt;code>proto&lt;/code>数量繁多或引用关系复杂，可以尝试使用&lt;code>protoc --descriptor_set_out=set.pb&lt;/code>生成&lt;code>proto&lt;/code>描述符集合。本质上它是一个使用了&lt;code>wire&lt;/code>编码的二进制文件，其中包括了所有需要的描述符。&lt;/p>
&lt;h3 id="字段serverreflection">字段&lt;code>serverReflection&lt;/code>&lt;/h3>
&lt;p>若目标服务器支持服务反射，将此项设为&lt;code>true&lt;/code>则不再需要提供上述三个字段。&lt;/p>
&lt;hr>
&lt;p>注：&lt;code>api-testing&lt;/code>对三种描述符来源的优先级顺序为&lt;/p>
&lt;p>&lt;code>serverReflection&lt;/code> &amp;gt; &lt;code>protoset&lt;/code> &amp;gt; &lt;code>protofile&lt;/code>&lt;/p>
&lt;h2 id="编写grpc-api测试">编写gRPC API测试&lt;/h2>
&lt;p>与编写&lt;code>HTTP&lt;/code>测试用例类型，您需要在根节点的&lt;code>api&lt;/code>字段定义服务器的地址。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#0000cf;font-weight:bold">127.0.0.1&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">7070&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>默认情况下&lt;code>api-testing&lt;/code>使用不安全的方式连接到目标服务器。若您想配置TLS证书，请参考文档&lt;a href="./secure-zh.md">关于安全&lt;/a>&lt;/p>
&lt;hr>
&lt;p>编写&lt;code>gRPC API&lt;/code>测试的方式与编写&lt;code>HTTP API&lt;/code>测试的方式基本相同。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">FunctionsQuery&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">request&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">api&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">/server.Runner/FunctionsQuery&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">body&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000;font-weight:bold">|&lt;/span>&lt;span style="color:#8f5902;font-style:italic">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> {
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;name&amp;#34;: &amp;#34;hello&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> }&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">expect&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">body&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000;font-weight:bold">|&lt;/span>&lt;span style="color:#8f5902;font-style:italic">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> {
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;data&amp;#34;: [
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> {
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;key&amp;#34;: &amp;#34;hello&amp;#34;,
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;value&amp;#34;: &amp;#34;func() string&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> }
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> ]
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> }&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>api&lt;/code>字段的格式为&lt;code>/package.service/method&lt;/code>，支持 gRPC 一元调用、客户端流、服务端流和双向流调用。&lt;/p></description></item><item><title>gRPC TLS verification</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/grpc-tls/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/grpc-tls/</guid><description>&lt;p>If you want to enable gRPC TLS, you need to generate your certificates in the workspace, or you can use an absolute path&lt;/p>
&lt;p>&lt;strong>1. 生成私钥&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>openssl genrsa -out server.key &lt;span style="color:#0000cf;font-weight:bold">2048&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>2. 生成证书（会提示即可，不必填写）&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>openssl req -new -x509 -key server.key -out server.crt -days &lt;span style="color:#0000cf;font-weight:bold">36500&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>国家名字
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Country Name &lt;span style="color:#ce5c00;font-weight:bold">(&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">2&lt;/span> letter code&lt;span style="color:#ce5c00;font-weight:bold">)&lt;/span> &lt;span style="color:#ce5c00;font-weight:bold">[&lt;/span>AU&lt;span style="color:#ce5c00;font-weight:bold">]&lt;/span>:CN
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>省份全名
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>State or Province Name &lt;span style="color:#ce5c00;font-weight:bold">(&lt;/span>full name&lt;span style="color:#ce5c00;font-weight:bold">)&lt;/span> &lt;span style="color:#ce5c00;font-weight:bold">[&lt;/span>Some-State&lt;span style="color:#ce5c00;font-weight:bold">]&lt;/span>:GuangDong
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>城市名
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Locality Name &lt;span style="color:#ce5c00;font-weight:bold">(&lt;/span>eg, city&lt;span style="color:#ce5c00;font-weight:bold">)&lt;/span> &lt;span style="color:#ce5c00;font-weight:bold">[]&lt;/span>:Meizhou
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>组织名
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Organization Name &lt;span style="color:#ce5c00;font-weight:bold">(&lt;/span>eg, company&lt;span style="color:#ce5c00;font-weight:bold">)&lt;/span> &lt;span style="color:#ce5c00;font-weight:bold">[&lt;/span>Internet Widgits Pty Ltd&lt;span style="color:#ce5c00;font-weight:bold">]&lt;/span>:Xuexiangban
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>组织单位名
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Organizational Unit Name &lt;span style="color:#ce5c00;font-weight:bold">(&lt;/span>eg, section&lt;span style="color:#ce5c00;font-weight:bold">)&lt;/span> &lt;span style="color:#ce5c00;font-weight:bold">[]&lt;/span>:go
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>服务器or用户的名字
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Common Name &lt;span style="color:#ce5c00;font-weight:bold">(&lt;/span>e.g. server FQDN or YOUR name&lt;span style="color:#ce5c00;font-weight:bold">)&lt;/span> &lt;span style="color:#ce5c00;font-weight:bold">[]&lt;/span>:kuangstudy
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>邮箱地址
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Email Address &lt;span style="color:#ce5c00;font-weight:bold">[]&lt;/span>:24736743@qq.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>3.生成csr&lt;/strong>&lt;/p></description></item><item><title>插件</title><link>https://linuxsuren.github.io/api-testing/latest/tasks/extension/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/tasks/extension/</guid><description>&lt;p>&lt;code>atest&lt;/code> 会把非核心、可扩展的功能以插件（extension）的形式实现。下面介绍有哪些插件，以及如何使用：&lt;/p>
&lt;blockquote>
&lt;p>在不同的系统中，插件有着不同的表述，例如：extension、plugin 等。&lt;/p>&lt;/blockquote>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>类型&lt;/th>
 &lt;th>名称&lt;/th>
 &lt;th>描述&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-orm">orm&lt;/a>&lt;/td>
 &lt;td>保存数据到关系型数据库中，例如：MySQL、Postgres 等&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-mongodb">mongodb&lt;/a>&lt;/td>
 &lt;td>保存数据到 MongDB 中&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-etcd">etcd&lt;/a>&lt;/td>
 &lt;td>保存数据到 Etcd 数据库中&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-iotdb">iotdb&lt;/a>&lt;/td>
 &lt;td>支持通过 Web UI 查询 IoTDB 数据&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-cassandra">Cassandra&lt;/a>&lt;/td>
 &lt;td>支持通过 Web UI 查询 Cassandra 数据&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-elasticsearch">Elasticsearch&lt;/a>&lt;/td>
 &lt;td>支持通过 Web UI 查询 Elasticsearch 数据&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-redis">redis&lt;/a>&lt;/td>
 &lt;td>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-s3">s3&lt;/a>&lt;/td>
 &lt;td>保存数据到对象存储中&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>存储&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-store-git">git&lt;/a>&lt;/td>
 &lt;td>保存数据到 Git 仓库中&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>数据&lt;/td>
 &lt;td>&lt;a href="https://github.com/LinuxSuRen/atest-ext-data-swagger">Swagger&lt;/a>&lt;/td>
 &lt;td>&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;blockquote>
&lt;p>&lt;code>atest&lt;/code> 也是唯一支持如此丰富的存储的接口开发、测试的开源工具。&lt;/p>&lt;/blockquote>
&lt;h2 id="下载插件">下载插件&lt;/h2>
&lt;p>我们建议通过如下的命令来下载插件：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>atest extension orm
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>上面的命令，会识别当前的操作系统，自动下载最新版本的插件。当然，用户可以通过自行编译、手动下载的方式获取插件二进制文件。&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 可以从任意支持 OCI 的镜像仓库中（命令参数说明中给出了支持的镜像服务地址）下载插件，也可以指定下载超时时间：&lt;/p></description></item><item><title>API 引用</title><link>https://linuxsuren.github.io/api-testing/latest/api/extension_types/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/latest/api/extension_types/</guid><description>&lt;p>// TBD.&lt;/p></description></item><item><title>v0.0.12</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.12/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.12/</guid><description>&lt;p>&lt;code>atest&lt;/code> 版本发布 v0.0.12&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是一款用 Golang 编写的、基于 YAML 格式的开源接口测试工具，可以方便地在本地、服务端、持续集成等场景中使用。
我们希望提供一个简单、强大、高质量的测试工具，方便测试、研发人员快速、低成本地借助接口测试为产品研发质量保驾护航。&lt;/p>
&lt;p>通过以下命令启动 HTTP 代理服务器后，给您的浏览器配置该代理，打开业务系统就会自动录制：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker run -p 1234:8080 -v /var/tmp:/var/tmp &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> ghcr.io/linuxsuren/api-testing atest-collector &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --filter-path /api &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> -o /var/tmp/sample.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># --filter-path /api 会过滤所有以 /api 为前缀的 HTTP 请求&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 关闭服务后，您可以在 /var/tmp/sample 这个目录中找到生成的测试用文件&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="更新重点">更新重点&lt;/h2>
&lt;ul>
&lt;li>支持通过基于 HTTP 代理服务生成测试用例&lt;/li>
&lt;li>支持根据 Swagger 数据生成接口测试覆盖率&lt;/li>
&lt;li>增加 HTML、Markdown 等格式的测试报告&lt;/li>
&lt;li>代码重构，包括：包结构、原文件名整理，逻辑抽象为接口以及不同实现&lt;/li>
&lt;li>支持打印所有支持的模板函数&lt;/li>
&lt;li>优化 Kubernetes 的部署清单文件&lt;/li>
&lt;li>修复已知缺陷&lt;/li>
&lt;/ul>
&lt;p>本次版本发布，包含了以下三位 contributor 的努力：&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/LinuxSuRen">@LinuxSuRen&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/wongearl">@wongearl&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/yJunS">@yJunS&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="相关数据">相关数据&lt;/h2>
&lt;p>下面是 &lt;code>atest&lt;/code> 截止到 v0.0.12 的部分数据：&lt;/p>
&lt;ul>
&lt;li>watch 3&lt;/li>
&lt;li>fork 9&lt;/li>
&lt;li>star 33&lt;/li>
&lt;li>contributor 4&lt;/li>
&lt;li>二进制文件下载量 561&lt;/li>
&lt;li>代码行数 7.6k&lt;/li>
&lt;li>单元测试覆盖率 94%&lt;/li>
&lt;/ul>
&lt;p>想了解完整信息的话，请访问 &lt;a href="https://github.com/LinuxSuRen/api-testing/releases/tag/v0.0.12">https://github.com/LinuxSuRen/api-testing/releases/tag/v0.0.12&lt;/a>&lt;/p></description></item><item><title>v0.0.13</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.13/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.13/</guid><description>&lt;p>&lt;code>atest&lt;/code> 版本发布 &lt;code>v0.0.13&lt;/code>&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是一款用 Golang 编写的、开源的接口测试工具。&lt;/p>
&lt;p>你可以在容器中启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker run -v /var/www/sample:/var/www/sample &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> --network host &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> linuxsuren/api-testing:master
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>或者，直接&lt;a href="https://github.com/LinuxSuRen/api-testing/releases/tag/v0.0.13">下载二进制文件&lt;/a>后启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>atest server --local-storage /var/www/sample
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>对于持续集成（CI）场景，可以通过在流水线中执行命令的方式：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 执行本地文件&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>atest run -p your-test-suite.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 执行远程文件&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>atest run -p https://gitee.com/linuxsuren/api-testing/raw/master/sample/testsuite-gitee.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 容器中执行&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>docker run linuxsuren/api-testing:master atest run -p https://gitee.com/linuxsuren/api-testing/raw/master/sample/testsuite-gitee.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>你也可以把测试用例转为 JMeter 文件并执行：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 格式转换&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>atest convert --converter jmeter -p https://gitee.com/linuxsuren/api-testing/raw/master/sample/testsuite-gitee.yaml --target gitee.jmx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 执行&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jmeter -n -t gitee.jmx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="主要的新功能">主要的新功能&lt;/h2>
&lt;ul>
&lt;li>增加了插件扩展机制，支持以 Git、S3、关系型数据为后端存储，支持从 &lt;a href="https://github.com/hashicorp/vault">Vault&lt;/a> 获取密码等敏感信息&lt;/li>
&lt;li>新增对 gRPC 接口的用例支持 @Ink-33&lt;/li>
&lt;li>支持导出 &lt;a href="https://github.com/apache/jmeter">JMeter&lt;/a> 文件&lt;/li>
&lt;li>支持通过 &lt;a href="https://operatorhub.io/operator/api-testing-operator">Operator&lt;/a> 的方式安装，并上架 OperatorHub.io&lt;/li>
&lt;li>提供了基本的 Web UI&lt;/li>
&lt;li>支持导出 PDF 格式的测试报告 @wjsvec&lt;/li>
&lt;/ul>
&lt;p>本次版本发布，包含了以下 5 位 contributor 的努力：&lt;/p></description></item><item><title>v0.0.14</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.14/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.14/</guid><description>&lt;p>&lt;code>atest&lt;/code> 版本发布 &lt;code>v0.0.14&lt;/code>&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是一款用 Golang 编写的、开源的接口测试工具。&lt;/p>
&lt;p>你可以在容器中启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker run --network host &lt;span style="color:#4e9a06">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#4e9a06">&lt;/span> linuxsuren/api-testing:v0.0.14
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>或者，直接&lt;a href="https://github.com/LinuxSuRen/api-testing/releases/tag/v0.0.14">下载二进制文件&lt;/a>后启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>atest server --local-storage /var/www/sample
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="主要的新功能">主要的新功能&lt;/h2>
&lt;ul>
&lt;li>增加了对 &lt;code>tRPC&lt;/code> 和 &lt;code>gRPC&lt;/code> 协议的（命令行与 Web 界面）支持&lt;/li>
&lt;li>新增了 Helm Chart 的安装方式&lt;/li>
&lt;li>支持通过按钮切换暗模式&lt;/li>
&lt;li>支持启动启动插件&lt;/li>
&lt;li>支持在 Web 界面中参数化执行&lt;/li>
&lt;li>支持生成 &lt;code>curl&lt;/code> 与 &lt;code>Golang&lt;/code> 代码&lt;/li>
&lt;li>支持从 Postman 中导入测试用例&lt;/li>
&lt;li>可观测方便，增加了对 Apache SkyWalking 和 Prometheus 的支持&lt;/li>
&lt;li>一些 Web 界面操作的优化（例如：多语言、测试结果缓存、自动保存）&lt;/li>
&lt;/ul>
&lt;p>本次版本发布，包含了以下 5 位 contributor 的努力：&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/Ink-33">@Ink-33&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/LinuxSuRen">@LinuxSuRen&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/hellojukay">@hellojukay&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/kuv2707">@kuv2707&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/yuluo-yx">@yuluo-yx&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="相关数据">相关数据&lt;/h2>
&lt;p>下面是 &lt;code>atest&lt;/code> 截止到 &lt;code>v0.0.14&lt;/code> 的部分数据：&lt;/p>
&lt;ul>
&lt;li>watch 7&lt;/li>
&lt;li>fork 23&lt;/li>
&lt;li>star 104&lt;/li>
&lt;li>contributor 12&lt;/li>
&lt;li>二进制文件下载量 1.1k&lt;/li>
&lt;li>代码行数 45k&lt;/li>
&lt;li>单元测试覆盖率 88%&lt;/li>
&lt;/ul>
&lt;p>想了解完整信息的话，请访问 &lt;a href="https://github.com/LinuxSuRen/api-testing/releases/tag/v0.0.14">https://github.com/LinuxSuRen/api-testing/releases/tag/v0.0.14&lt;/a>&lt;/p></description></item><item><title>v0.0.15</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.15/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.15/</guid><description>&lt;p>&lt;code>atest&lt;/code> 发布 &lt;code>v0.0.15&lt;/code>&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是致力于帮助开发者持续保持高质量 API 的开源接口工具。&lt;/p>
&lt;p>你可以在命令行终端或者容器中启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker run -p 8080:8080 linuxsuren/api-testing:v0.0.15
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="亮点">亮点&lt;/h2>
&lt;p>在本次版本发布之前，成功地为以下开源项目实现了 API 的 E2E 测试：&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/halo-dev/halo/pull/4892">halo-dev/halo&lt;/a>，一款 Java 实现的开源建站工具&lt;/li>
&lt;li>&lt;a href="https://github.com/dromara/hertzbeat/pull/1387">dromara/hertzbeat&lt;/a>，一款监控系统&lt;/li>
&lt;/ul>
&lt;p>非常期待 &lt;code>atest&lt;/code> 可以帮助更多的项目持续提升、保持 API 稳定性。&lt;/p>
&lt;h2 id="主要的新功能">主要的新功能&lt;/h2>
&lt;ul>
&lt;li>支持复用 Cookies（简化了基于 Cookie 做会话认证） (#301) @LinuxSuRen&lt;/li>
&lt;li>增加了基于 Docker 的应用性能监控 (#300) @LinuxSuRen&lt;/li>
&lt;li>支持以 Comment 的方式发送测试报告到 GitHub PR (#298) @LinuxSuRen&lt;/li>
&lt;li>UI 布局重构 (#297) @LinuxSuRen&lt;/li>
&lt;li>增加对 OAuth 认证的支持（包括 Device 模式） (#290) @LinuxSuRen&lt;/li>
&lt;li>支持设置 gRPC 的元数据 (#282) @LinuxSuRen&lt;/li>
&lt;li>增加了新的后端存储： Mongodb (#278) @LinuxSuRen&lt;/li>
&lt;/ul>
&lt;h2 id="致谢">致谢&lt;/h2>
&lt;p>本次版本发布，包含了以下 2 位 contributor 的努力：&lt;/p></description></item><item><title>v0.0.17</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.17/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.17/</guid><description>&lt;p>&lt;code>atest&lt;/code> 发布 &lt;code>v0.0.17&lt;/code>&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是致力于帮助开发者持续保持高质量 API 的开源接口工具。&lt;/p>
&lt;p>你可以在命令行终端或者容器中启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker run -p 8080:8080 ghcr.io/linuxsuren/api-testing:v0.0.17
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="亮点">亮点&lt;/h2>
&lt;ul>
&lt;li>我们提供了基于 Electron 的桌面应用，会极大地方便开发者在桌面环境中测试 API。&lt;/li>
&lt;li>为缩减镜像的体积（40M），我们把插件全部以 OCI 的格式单独存储，并在启用时自动下载。&lt;/li>
&lt;li>诞生了第二位项目 Committer &lt;a href="https://github.com/LinuxSuRen/api-testing/discussions/479">@yuluo-yx&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>非常期待 &lt;code>atest&lt;/code> 可以帮助更多的项目持续提升、保持 API 稳定性。&lt;/p>
&lt;h2 id="-主要的新功能">🚀 主要的新功能&lt;/h2>
&lt;ul>
&lt;li>支持通过 HTTP 请求执行测试套件 (#478) @LinuxSuRen&lt;/li>
&lt;li>增加 gRPC 接口对 TLS 的支持 (#477) @DWJ-Squirtle&lt;/li>
&lt;li>支持自动下载插件 (#471) @LinuxSuRen&lt;/li>
&lt;li>补充代码生成器的 e2e 测试 (#458) @LinuxSuRen&lt;/li>
&lt;li>支持复制测试用例和测试套件 (#455) @LinuxSuRen&lt;/li>
&lt;li>Web 界面上添加切换语言的按钮 (#447) @SamYSF&lt;/li>
&lt;li>支持通过 Web 界面查看 YAML 格式的测试套件 (#438) @SamYSF&lt;/li>
&lt;li>支持发送测试报告到 gRPC 服务 (#431) @lizzy-0323&lt;/li>
&lt;li>支持发送测试报告到 HTTP 服务 (#367) @hahahashen&lt;/li>
&lt;li>增加基于 Electron 的桌面应用 (#428) @LinuxSuRen&lt;/li>
&lt;li>实现了镜像 Registry 的 Mock 服务 (#425) @LinuxSuRen&lt;/li>
&lt;li>支持在 Web 界面启动、刷新 Mock 服务 (#410) @LinuxSuRen&lt;/li>
&lt;li>支持根据测试用例生成 JavaScript 代码 (#400) @YukiCoco&lt;/li>
&lt;li>支持根据测试用例生成 Python 代码 (#398) @zhouzhou1017&lt;/li>
&lt;li>支持根据测试用例生成 Java 代码 (#369) @Agility6&lt;/li>
&lt;li>增加日志框架的支持 (#389) @yuluo-yx&lt;/li>
&lt;li>生成 Golang 代码时支持 Cookie 的设置 (#363) @SLOWDOWNO&lt;/li>
&lt;li>测试用例支持 Cookie 设置 (#355) @LinuxSuRen&lt;/li>
&lt;/ul>
&lt;h2 id="-缺陷修复">🐛 缺陷修复&lt;/h2>
&lt;ul>
&lt;li>解决测试用例页面徽章显示的问题 (#462) @SamYSF&lt;/li>
&lt;li>解决无法导入 Postman 子集的问题 (#426) @SamYSF&lt;/li>
&lt;li>优化 gRPC 消息超过默认值的处理 (#399) @acceleratorssr&lt;/li>
&lt;li>解决 golang.org/x/net 的安全漏洞 CVE-2023-45288 (#401) @yuluo-yx&lt;/li>
&lt;li>修复生成 Golang 代码时对 HTTP 请求体的设置 (#383) @Agility6&lt;/li>
&lt;/ul>
&lt;h2 id="-文档">📝 文档&lt;/h2>
&lt;ul>
&lt;li>增加行为准则说明 (#379) @yuluo-yx&lt;/li>
&lt;li>增加安全漏洞相关的说明 (#391) @yuluo-yx&lt;/li>
&lt;li>更新贡献文档说明 (#380) @yuluo-yx&lt;/li>
&lt;/ul>
&lt;h2 id="-维护">👻 维护&lt;/h2>
&lt;ul>
&lt;li>用 openapi 官方的依赖库替换当前实现 (#439) @dshyjtdes8888&lt;/li>
&lt;li>增加 issue comment github actions (#382) @yuluo-yx&lt;/li>
&lt;/ul>
&lt;h2 id="致谢">致谢&lt;/h2>
&lt;p>本次版本发布，包含了以下 13 位 contributor 的努力：&lt;/p></description></item><item><title>v0.0.18</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.18/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.18/</guid><description>&lt;p>&lt;code>atest&lt;/code> 发布 &lt;code>v0.0.18&lt;/code>&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是致力于帮助开发者持续保持高质量 API 的开源接口工具。&lt;/p>
&lt;p>你可以在命令行终端或者容器中启动：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>docker run -p 8080:8080 ghcr.io/linuxsuren/api-testing:v0.0.18
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="亮点">亮点&lt;/h2>
&lt;ul>
&lt;li>在开源之夏 2024 中 &lt;code>atest&lt;/code> 增加了基于 MySQL 的测试用例历史的支持&lt;/li>
&lt;li>HTTP API Mock 功能的支持&lt;/li>
&lt;/ul>
&lt;p>在系统和平台的开发过程中，我们通常会采用前后端分离的开发模式。在后端API尚未开发完成、稳定化，并且未部署到公共集成测试环境之前，前端开发者往往需要通过硬编码数据来推进页面开发。待后端开发完成后，会进入所谓的“联调”阶段，这时可能会遇到以下问题：&lt;/p>
&lt;ul>
&lt;li>前端可能需要调整数据结构、页面布局和逻辑，并重新进行测试&lt;/li>
&lt;li>在实际查看页面后，可能会发现后端的数据结构和API的请求与响应需要调整&lt;/li>
&lt;/ul>
&lt;p>在最坏的情况下，前后端的联调可能会耗费远超预期的时间。为了更有效地解决这一问题，&lt;code>atest&lt;/code> 提供了HTTP API Mock功能。&lt;/p>
&lt;p>在设计评审阶段，我们可以根据API设计提供相应的Mock服务配置，从而快速模拟后端API的响应数据。例如：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">objects&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">users&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">sample&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000;font-weight:bold">|&lt;/span>&lt;span style="color:#8f5902;font-style:italic">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> {
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;name&amp;#34;: &amp;#34;LinuxSuRen&amp;#34;,
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;age&amp;#34;: 18
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> &amp;#34;gender&amp;#34;: &amp;#34;male&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"> }&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">proxies&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">path&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">/api/v1/projects/{projectID}&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">target&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">http://localhost:8080&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>把上面的内容放到 &lt;code>mock.yaml&lt;/code> 文件中，然后使用 &lt;code>atest mock --prefix /api/v1 --port 6060 mock.yaml&lt;/code> 命令即可启动一个 HTTP Mock 服务。&lt;/p></description></item><item><title>v0.0.20</title><link>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.20/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/releases/release-note-v0.0.20/</guid><description>&lt;p>&lt;code>atest&lt;/code> 发布 &lt;code>v0.0.20&lt;/code>&lt;/p>
&lt;p>&lt;code>atest&lt;/code> 是致力于为开发者提供一站式接口开发、测试的开源工具，无需注册账号、完全私有化部署、可扩展、可定制。&lt;/p>
&lt;h2 id="亮点">亮点&lt;/h2>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/499708a3-3498-4b9e-afb1-98b7fc466227" alt="">&lt;/p>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/d10088a0-90d1-42a0-a801-0e4c2b522006" alt="">&lt;/p>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/1d69012c-3420-43ca-9161-6a2b9fa32e87" alt="">&lt;/p>
&lt;p>&lt;img src="https://github.com/user-attachments/assets/827815b8-106c-4840-a0f7-802ebf79d50b" alt="">&lt;/p>
&lt;ul>
&lt;li>增加对正态分布随机函数的支持 (#761) @LinuxSuRen&lt;/li>
&lt;li>Web 页面支持快捷键绑定的特性，而且，用户可以通过配置文件修改 (#728) @LinuxSuRen&lt;/li>
&lt;li>Web 页面支持主题切换 (#715) @LinuxSuRen&lt;/li>
&lt;li>优化欢迎页面布局 (#708) @Aditya-132&lt;/li>
&lt;li>Mock 服务中增加 TCP 类型的代理 (#692) @LinuxSuRen&lt;/li>
&lt;li>支持多线程下载插件 (#669) @LinuxSuRen&lt;/li>
&lt;li>支持通过 HTTP 协议启动插件 (#664) @LinuxSuRen&lt;/li>
&lt;li>支持 SQL 语言编辑器的自动补全 (#722) @LinuxSuRen&lt;/li>
&lt;li>数据库 Web 客户端新增对 openGemini 的支持 (#665) @LinuxSuRen&lt;/li>
&lt;li>数据库 Web 客户端新增对 Cassandra 的支持 (#656) @LinuxSuRen&lt;/li>
&lt;li>数据库 Web 客户端新增对 IotDB 的支持 (#653) @LinuxSuRen&lt;/li>
&lt;li>Elasticsearch Web 客户端支持翻页功能 (#663) @LinuxSuRen&lt;/li>
&lt;/ul>
&lt;h2 id="-缺陷修复">🐛 缺陷修复&lt;/h2>
&lt;ul>
&lt;li>修复中英文语言切换失效的问题 (#720) @user-xixiboliya&lt;/li>
&lt;li>修复暗黑主题不生效的问题 (#714) @LinuxSuRen&lt;/li>
&lt;li>修复了非 JSON 响应的内容无法显示的问题 (#677) @KariHall619&lt;/li>
&lt;/ul>
&lt;h2 id="致谢">致谢&lt;/h2>
&lt;p>本次版本发布，包含了以下 5 位 contributor 的努力：&lt;/p></description></item><item><title>关于 API Testing.</title><link>https://linuxsuren.github.io/api-testing/about/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/about/</guid><description>&lt;section id="td-cover-block-0" class="row td-cover-block td-cover-block--height-auto js-td-cover td-overlay td-overlay--dark -bg-dark">
 &lt;div class="col-12">
 &lt;div class="container td-overlay__inner">
 &lt;div class="text-center">
 &lt;h1 class="display-1 mt-0 mt-md-5 pb-4">About API Testing&lt;/h1>
 
 &lt;div class="pt-3 lead">
 
 &lt;p>API Testing （atest）是一个接口调试和测试工具的开源项目。&lt;/p>
&lt;p>请继续阅读以了解更多信息，或访问我们的 &lt;a href="https://linuxsuren.github.io/api-testing/latest/">文档&lt;/a> 开始使用！&lt;/p>

 
 &lt;/div>
 &lt;/div>
 &lt;/div>
 &lt;/div>
 
&lt;/section>

&lt;div>&lt;a id="td-block-1" class="td-offset-anchor">&lt;/a>&lt;/div>
&lt;section class="row td-box td-box--black td-box--height-auto">
&lt;div class="col">
&lt;div class="container">
&lt;h2 id="objectives">Objectives&lt;/h2>
&lt;hr>
&lt;p>// TBD.&lt;/p>
&lt;/div>
&lt;/div>
&lt;/section></description></item><item><title>搜索结果</title><link>https://linuxsuren.github.io/api-testing/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://linuxsuren.github.io/api-testing/search/</guid><description/></item></channel></rss>