Katalon Studio 如何检测自定义关键字?
How does Katalon Studio detect a custom Keyword?
通常,人们会使用 Katalon Studio GUI 创建自定义关键字,如 docs 中所述:创建一个包,将 classes 存储在包中并将关键字操作(方法)标记为@keyword
.
因为我们想推动 Katalon Studio 找到它的边界,我在 groovy 文件中创建了一个包,定义了一个 class 并在其方法中添加了 @keyword
,然后放入/Keywords
文件夹。
我现在可以调用这些关键字,并确认在项目刷新后每个关键字都已成功添加到 Libs/CustomKeywords.groovy
文件中。
相反,如果我在位于其他地方的文件中添加关键字,例如在 /Include
文件夹中,它们不会添加到 Libs/CustomKeywords.groovy
。假设 Katalon Studio 只会从 /Keywords
文件夹导入关键字并最终导入 .jar libraries 是否安全?
/Include
文件夹是 Katalon 将检查其 BDD 文件的地方。因此,如果 /Include/features
中有一个包含一些已定义步骤的功能文件,Katalon 将搜索 /Include/scripts
以查找步骤定义文件。
Each Gherkin step in the Features file needs to be defined as a set of programming code so that the machine can execute the actions of these steps. These Step Definitions can be implemented in Keyword folder by leveraging the Script Mode. Katalon Studio built-in keywords can also be re-used in step definition files as well. When Katalon Studio executes any Features files in the test case, it will also look for the matching step definitions in the source folder.
这部分
These Step Definitions can be implemented in Keyword folder by leveraging the Script Mode.
可能听起来令人困惑,但它基本上是说步骤定义可以包含来自 /Keyword
文件夹的自定义关键字。
这就是为什么我不会在此处放置其他自定义关键字的原因。
另一个可以放置自定义代码的地方是 /Test Listeners
部分。这将包含 SetUp() and TearDown() 测试套件和测试用例方法的代码。
通常,人们会使用 Katalon Studio GUI 创建自定义关键字,如 docs 中所述:创建一个包,将 classes 存储在包中并将关键字操作(方法)标记为@keyword
.
因为我们想推动 Katalon Studio 找到它的边界,我在 groovy 文件中创建了一个包,定义了一个 class 并在其方法中添加了 @keyword
,然后放入/Keywords
文件夹。
我现在可以调用这些关键字,并确认在项目刷新后每个关键字都已成功添加到 Libs/CustomKeywords.groovy
文件中。
相反,如果我在位于其他地方的文件中添加关键字,例如在 /Include
文件夹中,它们不会添加到 Libs/CustomKeywords.groovy
。假设 Katalon Studio 只会从 /Keywords
文件夹导入关键字并最终导入 .jar libraries 是否安全?
/Include
文件夹是 Katalon 将检查其 BDD 文件的地方。因此,如果 /Include/features
中有一个包含一些已定义步骤的功能文件,Katalon 将搜索 /Include/scripts
以查找步骤定义文件。
Each Gherkin step in the Features file needs to be defined as a set of programming code so that the machine can execute the actions of these steps. These Step Definitions can be implemented in Keyword folder by leveraging the Script Mode. Katalon Studio built-in keywords can also be re-used in step definition files as well. When Katalon Studio executes any Features files in the test case, it will also look for the matching step definitions in the source folder.
这部分
These Step Definitions can be implemented in Keyword folder by leveraging the Script Mode.
可能听起来令人困惑,但它基本上是说步骤定义可以包含来自 /Keyword
文件夹的自定义关键字。
这就是为什么我不会在此处放置其他自定义关键字的原因。
另一个可以放置自定义代码的地方是 /Test Listeners
部分。这将包含 SetUp() and TearDown() 测试套件和测试用例方法的代码。