UiPath Documentation
studio
2022.10
false
Studio 用户指南
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。

测试用例

概述

Studio 中的应用程序测试以 VB 或 C# 执行。您可以为数据验证或与 CI/CD 管道集成等方案创建单个自动化项目。在 Studio 中设计工作流。您可以采用 VB 或 C# 来执行自动化应用程序测试

条件

  • Perform application testing through test cases and data-driven test cases.
  • 如果测试自动化项目包含多个线性执行的测试用例,则测试自动化项目可能会有多个入口点,因为活动是按顺序组织的。
  • 除非调用其他 XAML 文件,否则按测试用例执行工作流。
  • 您可以将工作流转换为测试用例,从其他项目导入工作流或创建新的工作流。

依赖项

创建测试用例

您可以通过从现有项目中调用工作流来创建测试用例。

  1. 在 Studio 中打开工作流。

  2. 在“项目”面板中,右键单击工作流,然后选择“创建测试用例”

  3. (Optional) Select Mock workflow under test when you create your test case if you want to make a copy of your workflow where you can mock specific activities. If you have an existing mock file that you want to use, you can select it from the Mock dropdown. For more information, see Mock Testing.

  4. (Optional) Select a Template from the dropdown list if you have created one previously. For more information, see Test Case Templates.

  5. (Optional) Add the test case to an Execution Template. You need to have created an execution template first. For more information, see Create execution template.

  6. Click Next if you want to add test data.

  7. 单击“创建”以确认更改。

    系统将创建测试用例 XAML 文件,调用具有以下容器的工作流:“Given”、“When”和“Then”。该文件是在“调用工作流文件”活动内部得到了调用,该活动为“When”容器的一部分。

工作流中的参数将自动导入。要查看或添加更多参数,请单击“调用工作流文件”活动中的“导入参数”按钮。

提示:

请查看以下附加操作:

发布测试用例

默认情况下,测试用例和数据驱动型测试用例都将创建为草稿。在发布到 Orchestrator 之前,您需要将测试用例设为可发布。您可以通过右键单击工作流,然后选择“设为可发布”,将单个或多个测试用例设为可发布。

XAML 图标将变为蓝色,表示测试用例已准备好发布并打包到 NUPKG 文件中。要还原为工作流草稿,请右键单击该工作流,然后选择“从发布中忽略”

重要提示:

You can publish the test cases to Orchestrator, to Robot defaults or a custom path. If you want to publish to Orchestrator, make sure your Robot or UiPath Assistant is connected to Orchestrator.

Publishing to Orchestrator is also required when you want to execute automated tests through Test Manager. Make sure to publish the package to the Orchestrator Tenant Process Feed, then link the test cases to Test Manager. Publishing the package in a different folder may result in execution errors.

将工作流转换为测试用例

要将工作流转换为测试用例,请在“项目”面板中右键单击该工作流,然后选择“转换为测试用例”

Result: The workflow becomes a Test Case, and is regenerated based on the BDD Test Case template.

导入测试用例

如果您已经创建工作流或测试用例,则可以通过右键单击项目节点,然后选择“导入测试用例”,将其导入到当前项目中。导入的 XAML 文件会作为测试用例草稿添加到项目中。

导入服务

Similarly to importing data collections into API Test Automation libraries, you can import such collections into your Application Testing processes using the New Service wizard.

备注:

这仅适用于 Studio 配置文件中创建的库和“测试自动化”项目。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新