Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: chinese blog #584

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a8a1ddb
Draft: chinese blog
zhou9584 Aug 25, 2023
f554255
Update blog.md
zhou9584 Aug 25, 2023
404aac7
Create script.txt
zhou9584 Aug 30, 2023
e8e1b86
update script
zhou9584 Sep 6, 2023
4bf4c9a
Update blog.md
zhou9584 Sep 7, 2023
2ba00f0
replace pic with table
zhou9584 Sep 7, 2023
3304ca3
Update blog.md
zhou9584 Sep 7, 2023
3045c15
Update script.txt
zhou9584 Sep 12, 2023
cde3623
Merge branch 'main' into zhoule/BlogChineseVersion
zhou9584 Sep 14, 2023
ae4bf65
更新blog及图片
zhou9584 Sep 14, 2023
8e8a3bc
Update blog.md
zhou9584 Sep 14, 2023
5fbad9e
Update blog.md
zhou9584 Sep 14, 2023
a84be4b
Update 测试流程图.jpg
zhou9584 Sep 15, 2023
3e6f544
Update blog.md
zhou9584 Sep 15, 2023
fb087be
Update blog.md
zhou9584 Sep 19, 2023
1e88ab8
Update blog.md
zhou9584 Sep 19, 2023
a5d6c1b
Update blog.md
zhou9584 Sep 19, 2023
680193f
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
2456e46
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
e9c134b
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
09ec36d
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
243956b
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
b060747
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
8448576
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
589068b
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
9d0a6a7
Update blog.md
zhou9584 Sep 19, 2023
6451b91
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 19, 2023
74e298b
Update blog.md
zhou9584 Sep 19, 2023
59a21ba
Update docs/blog/blog_chinese_version/blog.md
zhou9584 Sep 20, 2023
156d710
Update blog.md
zhou9584 Sep 20, 2023
5d3828c
add qr code
zhou9584 Oct 10, 2023
e8527f4
update qr code
zhou9584 Oct 10, 2023
20395e6
update qr code
zhou9584 Oct 10, 2023
b485d06
Update 目标宣言.jpg
zhou9584 Oct 10, 2023
1eb707b
Update blog.md
zhou9584 Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added docs/blog/blog_chinese_version/1692864197387.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692864702416.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692864736101.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692864918378.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692865230943.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692865540488.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692865572379.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692865645266.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692865803974.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/blog/blog_chinese_version/1692866390077.jpg
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions docs/blog/blog_chinese_version/blog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Hydra Lab ———为微软移动端产品线智能测试赋能
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved

[Hydra Lab: 让智能云测试更简单](https://github.com/microsoft/HydraLab)
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved

## Hydra Lab 是什么?

下面的视频将介绍 Hydra Lab 的功能以及定位。

https://github.com/microsoft/HydraLab/assets/8344245/cefefe24-4e11-4cc7-a3af-70cb44974735

通过 Hydra Lab,用户可以构建一个私有的测试云平台,它可以基于 RESTful 接口快速集成 DevOps 系统,换句话说,就像部署了一个可管理的私有“Firebase Test Lab”。
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved

## 我们为什么需要 Hydra Lab?

Hydra Lab 是一个开源的项目,它于 2022 年 12 月在 [github.com/microsoft](https://github.com/microsoft) 下发布。作为一个开源项目,它很好地确保了可控性,提供了定制化的能力,消除了在集成云测试平台可能遇到的以下问题:

- **可信度**:将调试应用程序包上传到第三方平台是否安全?我们能否完全信任第三方平台?使用第三方平台是否有合规性要求?
- **定制性**:第三方平台是否有与测试兼容的真实设备?是否支持跨平台场景?
- **成本**:这些平台的定价是否合理?
- **设备共享**:能否将我们的设备接入云端,并在不同地区,不同团队之间共享?

Hydra Lab 是一个基于 Appium, Espresso, Maestro, XCTest 等框架打造的一个免费的、可定制的、可信赖的框架。由于它具备集成不同测试框架的胶水代码(适配器)、可复用可扩展的设计以及软件测试生命周期的定义,所以可以支持新的测试框架和智能测试。我们始终致力于“让智能云测试更简单”,“打造个人的智能测试云”的目标,并在 Azure DevOps 中建立了标准化的 CI/CD 流程,借助单元测试、接口测试、跨平台用户验收测试等环节为产品质量把关,迄今为止已经发布了 27 个稳定版本。

## Hydra Lab 如何在微软为测试赋能?

在过去的两年中,我们已经将 Hydra Lab 集成到软件开发流程中,并通过搭建的内部平台为各个移动产品提供无感的自动化测试服务,例如 Phone Link, Link to Windows for Android and iOS, Office Union for Android, Teams Android 等产品。

在微软,我们基于这个框架搭建了一个 Hydra Lab 服务中心,它的协作模式以及架构如下图:

![架构图](1692864197387.jpg)

我们将 Hydra Lab 中心服务的 docker 镜像部署在 Azure 上作为测试中心,它向内部用户提供了基于 AAD OAuth 的 RESTful API,这些用户可以使用 Azure DevOps Pipeline 来创建一个 Espresso 或 Appium 类型的测试任务,并推送至测试中心。在收到测试请求后,测试中心会选择合适的测试代理和设备来运行测试任务。测试代理则会选择对应的测试框架运行任务,并在测试完成后将结果返回给测试中心。最终,用户可以在测试中心的网页上查看这些测试报告。

用户可以参考 [测试代理部署手册](https://github.com/microsoft/HydraLab/wiki/Test-agent-setup) 配置测试服务器,并注册到 Hydra Lab 中心服务。

**名词定义:**

| 术语 | 缩写 | 定义 |
|----|----|----|
|Hydra Lab 中心服务| 测试中心 | Hydra Lab 中心服务是一个通过docker容器部署于**云端**的 Spring Boot 应用,提供RESTful 接口,用于分配测试任务、提供UI界面,收集并展示测试报告。 |
|Hydra Lab 测试代理服务器 | 测试代理 | Hydra Lab 测试代理服务器是指运行 Hydra Lab 代理服务的机器,物理连接各种测试设备,通过 WebSocket 与 Hydra Lab 中心服务保持通信。 |

**测试流程图:**
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved

![Alt text](1692864702416.jpg)

Hydra Lab 通过 [Hydra Lab Azure DevOps 插件](https://marketplace.visualstudio.com/items?itemName=MaXESteam.hydra-lab-alter) 为无缝集成提供支持,这也是 DevOps 流程中,使整个测试流程完全自动化的关键组成部分。同时我们也提供了 [Gradle 插件](https://github.com/microsoft/HydraLab/wiki/Trigger-a-test-task-run-in-the-Hydra-Lab-test-service)的集成模式,为更多的安卓开发者提供支持。

![Alt text](1692864736101.jpg)

为了确保中心服务、代理服务器、测试设备发生异常时能被及时发现,我们还基于 Prometheus + Grafana 搭建了一套监控系统。监控告警流程如下图所示:

![Alt text](1692864918378.jpg)

## 快速入门

如果用户想快速尝试并了解 Hydra Lab ,我们提供了一键部署的 docker 镜像,只要机器上安装了 docker 和 ADB,输入以下命令:
zhou9584 marked this conversation as resolved.
Show resolved Hide resolved

```
docker run -p 9886:9886 ghcr.io/microsoft/hydra-lab-uber:latest
```

然后就可以打开 **http://localhost:9886/portal** ,并开始使用 Hydra Lab 的基本功能:测试设备管理,测试任务管理,使用各种测试驱动,查看测试报告,测试视频等。

关于更多的使用细节,请参考 GitHub 文档:[如何部署 Hydra Lab 中心服务](https://github.com/microsoft/HydraLab/wiki/Deploy-Center-Docker-Container)。

## 基于 GPT/LLM 的智能测试

**如果有一百万只猴子在一百万个键盘上随机敲一百万年,就可以写出一部莎士比亚的著作。**

![DALL-E 2](1692865230943.jpg)

现阶段,我们的目标是将大型语言模型(LLMs)集成到我们的平台中,提高我们在测试结果分析、探索性测试和测试用例生成方面的能力。在软件测试的历史上,Monkey Test(在屏幕或 IO 设备上发起随机操作,模仿猴子的偶然行为)一直是一个广受欢迎的方法,来评估应用程序的可靠性。Monkey Test的优势在于它的简单性,即不需要维护测试用例,就可能在初始测试阶段发现问题。然而,它局限于随机操作的粗糙性。想象一下,如果我们能够引入一个更智能的 “Monkey”,它可以真正理解应用程序并像人类一样与之交互,这种测试方法是否可以得到改进?

![Alt text](1692865540488.jpg)

于是我们引入了 SEE(启动-提取-评估)探索模型,它的运行方式如下:首先,启动应用程序并配置环境。然后,确定并理解交互元素,将它们的描述转换为向量或其他计算机可处理的格式。利用这些处理过的数据,制定决策,执行操作,并评估结果。随后,回到提取阶段,获取新的状态。这个循环过程与马尔可夫奖励过程有着相似之处。

![Alt text](1692865572379.jpg)

探索之后,我们可以基于这些结果数据生成测试用例。生成黑盒测试用例的难点在于黑盒中庞大上下文,一般的模型很难分析如此庞大的数据量。因此,我们尝试将其转换为机器学习模型,或大型语言模型(LLM)可以处理的结构化数据,并在该方向上持续探索。

![Alt text](1692865645266.jpg)

## 开发实践

我们的核心贡献团队使用 [HydraLab/CONTRIBUTING.md](https://github.com/microsoft/HydraLab/blob/main/CONTRIBUTING.md) 作为开发规范。一般情况下,我们使用 PlantUML 来描述 Hydra Lab 的架构、绘制开发设计图、定义组件和类之间的关系。这样我们就可以轻松地审查一个功能的设计,并在 PR 中提供建议。

我们鼓励在每次新的代码变更中添加单元测试,并且我们也在 CI 中搭建了 BVT,在 CD 中进行了基于接口调用的用户验收测试。下图是我们用到的部分技术组件,如果您有兴趣参与开发,我们随时欢迎您加入团队。

![Alt text](1692866390077.jpg)

![Alt text](1692865803974.jpg)
33 changes: 33 additions & 0 deletions docs/blog/blog_chinese_version/script.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
English:
Hydra Lab, an open-source test automation framework, empowers development teams to establish a cost-effective, private cloud testing platform utilizing existing testing devices.
It functions in a similar manner to well-known cloud testing platforms, such as BrowserStack or Google Firebase, bolstering your DevOps process with a cloud-based continuous testing workflow, ultimately fortifying quality assurance.
Additionally, the open-source element of Hydra Lab allows for enhanced control and customization, eliminating apprehensions over uploading extensive debug information packages to third-party platforms.
The framework of the Hydra Lab cloud test is comprised of two segments: the center and the agent. The Hydra Lab center can be conveniently deployed on Azure via our released Docker image, while the agent can be executed on any JVM supported platform.
Upon successful authentication with the center, the agent service registers the device to a preset Hydra Lab center service, subsequently establishing a bidirectional RPC connection for future test tasks and device communication.
This thoughtful design ensures the test process pressure is evenly dispersed across the managed agents by the management center.
Remarkably, even with Azure's smallest VM instance (3.5GB RAM, 1 CPU core machine), the Hydra Lab center service can manage connections with over 100 agents and handle more than 500 test devices with ease.
To facilitate user experimentation with the service, we provide a comprehensive Docker image that can be deployed and operated via a simple one-line command, leveraging Docker support locally.
This feature offers hands-on experience with core Hydra Lab features such as test device management, test task management, test runner, report viewer, test video navigator, among others.
Having incorporated Hydra Lab into our operations for two years, our internal service currently facilitates test automation for an array of mobile products, including Phone Link, Link to Windows Android+ iOS, Office Union Android, Teams Android, and more.
By managing and executing thousands of test cases daily across devices globally, we have gleaned invaluable insights from our diverse user base.
Following open-sourcing in 2023, Hydra Lab has earned the honor of being ranked as the top project under the GitHub topic 'cloud testing' and one of the top five under 'platform-engineering.'
Guided by our mission, "intelligent cloud testing made easy," our focus is on harnessing AI to enhance test automation, propelling it towards test intelligence.
This year, we joined forces with the DKI team to integrate the Large Language Model (LLM) to improve test result analysis, exploratory testing, and test case generation with the application functional graph.
We are optimistic that this integration will transform the testing experience, empowering development teams worldwide to achieve even greater results.

中文:
Hydra Lab,是一个开源的自动化测试框架,可以利用现有的测试设备,帮助开发团队建立一个高效的、私有的云测试平台。
它的功能与一些知名的云测试平台类似,比如 BrowserStack 或 Google Firebase,它可以通过云端的持续测试工作流,优化开发者团队的 DevOps 流程,为产品质量提供保证。
另外,Hydra Lab 的开源属性确保了安全可控,消除了将带有大量调试信息的应用上传到第三方平台的隐藏风险,同时可以更好地满足定制化需求。
Hydra Lab 云测试框架由两个部分组成:中心端和代理端。Hydra Lab 中心端可以通过 Docker 镜像快速地部署在 Azure 上,而代理端可以在任何支持 JVM 的系统上运行。
代理端在与中心端验证身份成功后,可以将设备注册到 Hydra Lab 中心端,随后建立一个双向的 RPC 连接,用于后续的测试任务和设备通信。
这种设计可以确保大量测试任务带来的压力,由中心端均匀地分散到各个的代理端上。
得益于这种部署模式,即使使用 Azure 最低性能的虚拟机实例(3.5GB RAM,1 CPU),Hydra Lab 中心端也可以轻松地管理超过 100 个代理端和 500 多个测试设备。
为了方便用户快速尝试并了解 Hydra Lab ,我们提供了一个一键部署的 docker 镜像,可以通过简单的一行命令,在本地完成部署。
这个镜像提供了 Hydra Lab 的基本功能,如测试设备管理,测试任务管理,使用各种测试驱动,查看测试报告,测试视频等。
在过去的两年中,我们已经将 Hydra Lab 集成到内部软件开发流程中,我们在内部搭建的平台现在为各个移动产品提供便捷的自动化测试服务,例如 Phone Link, Link to Windows for Android and iOS, Office Union for Android, Teams Android 等。
现在分布在全球范围内的代理端,每天都会管理和执行数千个测试用例,这也帮助我们从多个的用户群中赢得了好评。
在 2023 年开源后,Hydra Lab 在开源社区中快速发展,目前在“cloud testing” 主题下的排名第一,并且还是 “platform-engineering” 主题下的前五名。
致力于“让智能云测试更简单”的目标,我们现在的重点是利用 AI 来提升测试自动化,推动它向测试智能化发展。
目前,我们与内部的团队合作,将大型语言模型(LLM)与应用功能星状图相结合,以提高测试结果分析、探索性测试和测试用例生成的效果。
我们将会在这个方向持续探索,并坚信它将改变测试体验,帮助全球的开发团队取得更好的成果。