首页 > 解决方案 > 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'))
    }

标签: groovycucumberkatalon-studio

解决方案


根据文档,您需要将空映射作为参数列表传递(前提是您没有任何参数)。此外,您可以设置失败处理,并且在指定测试用例名称时需要使用findTestCase()(not )。findTestObject()

尝试以下行:

Mobile.callTestCase(findTestCase('Test Cases/mobile random email'), [:], FailureHandling.OPTIONAL)

推荐阅读