- 发行说明
- 入门指南
- 设置和配置
- 自动化项目
- 依赖项
- 工作流类型
- 文件比较
- 自动化最佳实践
- 源代码控件集成
- 调试
- 诊断工具
- 工作流分析器
- 变量
- 参数
- 导入的命名空间
- 基于触发器的 Attended 自动化
- 控制流程
- 对象存储库
- 日志记录
- ScreenScrapeJavaSupport 工具
- Studio 测试
- 扩展程序
- 故障排除
概述
测试自动化框架是一个模板,通过整合必要的最佳实践,为测试项目奠定基础。 该框架包含管理资产、常量、记录和异常处理的功能。
工作方式
模板遵循三个连续的阶段:
-
设置 (SetUp.xaml) — 此阶段,系统将读取“Assets.json”文件并初始化流程中使用的应用程序。如果初始化成功,则执行将转到“运行测试”阶段。如果失败,则执行将结束,并且测试用例将失败,生成可在 Orchestrator 中使用的屏幕截图。
- InitAllAssets.xaml — 此阶段,系统会初始化、填充并输出在整个项目中使用的配置字典“资产”。从 Orchestrator 中检索资产。
-
Run Test (placeholder for test case)— This phase is where the Test Case is executed. The Placeholder activity changes at runtime into an Invoke Workflow File activity. This activity then invokes the Test Case with the execution template attached to it. This creates a temporary workflow file called Generated – testCaseName. The Test Case is wrapped in a Timeout Scope that has the Throw Exception After input value set to theTestTimeOut constant. If the execution of the Test Case exceeds theTestTimeOut, it stops the execution. This is useful in case a process ends up in an infinite loop, as it stops the execution so the robot can be free.
-
拆卸 (TearDown.xaml) — 此阶段,系统将完成测试用例的执行,并执行必要的操作以清理环境以供将来运行。
- KillAllProcesses.xaml — 强制终止代表业务流程中使用的应用程序的 Windows 流程。但是,终止进程可能会导致意外结果,例如丢失未保存的文件更改。尽管工作流名称如此,但并不一定会始终终止所有使用的流程。根据业务流程的要求,其他步骤可能更适合将系统恢复到清理状态。
-
TakeScreenshots.xaml — 截取整个屏幕的屏幕截图,并将其以 .PNG 格式保存在由 in_Folder 参数指定的文件夹中。您可以在工作流中的任意位置调用此阶段。
自定义模板
要为您的特定用例配置模板,请按照以下步骤操作:
-
在“数据”文件夹中,打开 Assets.json 文件,然后添加您需要访问的 Orchestrator 资产。
备注:将 Assets.json 文件用于任何类型的资产,凭据除外。 要使用 Orchestrator 中定义的凭据资产,请将其添加为“常量”。
-
在 Data Manager 的“常量”下,添加要使用的凭据资产。要访问凭据,请添加“获取凭据”活动。
提示:如果凭据资产存储在并非运行流程的 Orchestrator 文件夹中,请创建另一个“常量”来存储文件夹名称。
-
更改“测试超时”常量以修改测试用例的允许执行时间。
此项目模板的默认依赖项包括 UiPath.System.Activities、UiPath.UIAutomation.Activities 和 UiPath.Testing.Activities。