- 发行说明
- 入门指南
- 设置和配置
- 自动化项目
- 依赖项
- 工作流类型
- 文件比较
- 自动化最佳实践
- 源代码控件集成
- 调试
- 诊断工具
- 工作流分析器
- 变量
- 参数
- 导入的命名空间
- 基于触发器的 Attended 自动化
- 控制流程
- 对象存储库
- 日志记录
- ScreenScrapeJavaSupport 工具
- Studio 测试
- 扩展程序
- 故障排除
测试用例模板
Use test case templates as base models for your test cases. For example, you can create a template with data variations to be reused on different tests. You can create test case templates for Test Automation projects, including other file types such as Global Exception Handler. For other projects (e.g., Process), you can create workflow templates.
条件
-
模板特定于项目类型和用于创建项目的语言。
-
模板无法转换为工作流,也无法进行编译或发布。
-
You can make use of reusable content by creating a library with test case templates. Test data variation is not exported to the library alongside the test case template.
重要提示:模板中引用的资源不会在本地复制到您尝试导入库的项目。 模板不应包含对其他资产的引用,例如库中的工作流。
模板来源
When you add a new file, you can choose a template on which to base it. The templates that you can choose from vary depending on the type of file you are adding (workflow or test case) and on whether you have previously added templates to your project Templates folder.
内建范本
空白测试用例
Choose Empty Test Case when you create a test case if you want to add a Placeholder activity that you want to invoke at a later stage.
BDD 测试用例
BDD stands for Behavioural-Driven Development. Choose BDD Test Case when you create a test case to structure your test around Given-When-Then containers.
本地文件模板
The local templates are created in the Templates folder of the project when you extract a file as template and when you add a template to the Templates folder. Local file templates are available only inside the project where you create, or extract them.
You can create local templates of three types: execution template, workflow template, and test case template. When you extract a file as a template, the template type is applied automatically based on the type of file you extract (workflow or test case). When you manually add a template to the Templates folder, you select the type of template to create.
包文件模板
超时测试
The Test With Timeout template is available only with the Testing activity package, version 22.10 or higher. Choose Test With Timeout when you create a test case if you want to use a timeout or to take screenshots when a verification fails.
该模板配置为引发基于时间的异常,并对工作流中发生的故障进行屏幕截图。
- 如果将
takeScreenshotOnException布尔变量设置为false,请确保修改TimeoutScope活动的Timeout Message属性。 - 您可以在
duration变量中修改超时。默认设置为五 (5) 分钟。 - 您可以通过配置“测试项目设置”,将屏幕截图保留在计算机上。
添加本地文件模板
You can use the contextual menu in the Project panel to manually add execution, and test case templates based on other templates to your project. After you add a template, you can edit it in the Designer, and then use it as a starting point for creating other files.
-
To add a test case template, right-click the Templates folder, and then select Add > Test Case Template. Follow the test case creation process to configure the template.
-
要添加执行模板,请右键单击“模板”文件夹,然后选择“添加”>“执行模板”。
将文件提取为模板
-
在 Studio 中打开工作流。
-
在“项目”面板中,右键单击一个测试用例,然后选择“提取为模板”。
您的测试用例现已存储在“项目”>“模板”中。您可以复制并粘贴该测试用例,也可以将其移回测试文件夹中。
- 您可以直接从“Templates”文件夹中为测试用例和工作流创建模板。
- You can use the contextual menu within the Templates folder to perform various actions, such as comparing files.
库中的测试用例模板
You can create test case templates in libraries the same way you create them in processes. After you publish the library, the templates marked as public are available as package file templates in projects where the library is installed.
根据模板创建测试用例
-
创建一个测试项目。
-
构建要用作模板的任何测试用例。
-
When you finish building the test case, right-click it, and select Extract as Template.
Name the template, choose the Templates folder as the location to store it in, and select Create. For this example, the name of the template is MyFirstTestCaseTemplate.
-
Go to the Design tab, in the File group, select New > Test Case. The New Test Case window is displayed.
-
Give it an appropriate name, and select the template that you previously created from the Template dropdown list. For this example, choose MyFirstTestCaseTemplate.
删除模板
To remove a template, expand the Templates folder in the Project panel, right-click the template, and then select Delete.