groovy - Katalon:没有方法签名
问题描述
我正在尝试在常规步骤定义中调用测试用例。此测试用例调用自定义关键字。
问题:
10-28-2019 04:12:05 PM Invita utente
Elapsed time: 1,962s
carrier.invita_utente.Invita_utente:70
Invita utente FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.callTestCase() is applicable for argument types: (null) values: [null]
Possible solutions: callTestCase(com.kms.katalon.core.testcase.TestCase, java.util.Map), callTestCase(com.kms.katalon.core.testcase.TestCase, java.util.Map, com.kms.katalon.core.model.FailureHandling)
自定义 k。
public class randomEmail {
/**
* Check if element present in timeout
* @param to Katalon test object
* @param timeout time to wait for element to show up
* @return true if element present, otherwise false
*/
@Keyword
public String getEmail(String suffix,String prefix){
int randomNo = (int)(Math.random() * 1000);
return suffix + randomNo + "@" + prefix;
}
}
脚本:步骤定义
@Then("Invita utente")
def Invita_utente() {
Mobile.setText(findTestObject('Carrier/28-invita utente/android.widget.EditText0 - Inserisci la ragione sociale dellazienda'),
'pittigghiu', 0)
Mobile.callTestCase(findTestObject('Test Cases/mobile random email'))
}
解决方案
根据文档,您需要将空映射作为参数列表传递(前提是您没有任何参数)。此外,您可以设置失败处理,并且在指定测试用例名称时需要使用findTestCase()
(not )。findTestObject()
尝试以下行:
Mobile.callTestCase(findTestCase('Test Cases/mobile random email'), [:], FailureHandling.OPTIONAL)
推荐阅读
- c# - 如何在没有 Visual Studio 和源代码的情况下运行 NUnit 测试?
- python - 使用 i 而不是 j 加载具有复数的文本文件
- sql - 无法使用 SQL/OPENXML 查询 XML 文档
- flutter - 当验证错误发生抖动时,有什么方法可以专注于 TextFeild?
- r - 如何通过一个共同的关键字组合相似级别的因子变量
- node.js - 为什么 Intellij 在“幽灵”断点处停止
- python - 使用共享范围滑块绘制子图
- python - 问题涉及 WSL、Gunicorn、Docker 和 Flask
- python - numpy.ctypeslib:C 代码在传递的 numpy 数组中将所有其他索引视为零
- python - Python3 - Matplotlib FuncAnimation 连续内存泄漏