Automated tests 空手道-在一个功能中运行多个场景-参考错误(重试)

Automated tests 空手道-在一个功能中运行多个场景-参考错误(重试),automated-tests,karate,Automated Tests,Karate,我使用空手道软件,我想包括一些场景到一个功能-在非并行状态下运行它,场景需要按照从上到下的顺序运行 我有以下代码: @parallel=false Feature: TC_C - Component detail check Scenario: Check component detail # Login (prerequisity) * call read('classpath:ui/common/login.feature') * waitForUrl('/app

我使用空手道软件,我想包括一些场景到一个功能-在非并行状态下运行它,场景需要按照从上到下的顺序运行

我有以下代码:

@parallel=false
Feature: TC_C - Component detail check

Scenario: Check component detail

    # Login (prerequisity)
    * call read('classpath:ui/common/login.feature')
    * waitForUrl('/applications')
    * match driver.url == baseUrl + 'applications'

    # Step 0 (Create an application and a component inside)
    * call read('classpath:ui/common/applicationCreation.feature')
    * call read('classpath:ui/common/componentCreation.feature')

Scenario: Step1

    # Step 1
    When retry(20, 3000).click('//*[normalize-space(text()) = \'' + compName + '\']/../td/a/span[2][normalize-space(text()) = \'Detail\']/..')
    Then waitForText('.card-header', 'Component Detail')
“场景:检查组件详细信息”成功通过

问题在于发生错误的第二个场景的第一行:

com.intuit.karate.exception.KarateException: TC_C.feature:18 - javascript evaluation failed: retry(20, 3000).click('//*[normalize-space(text()) = \'' + compName + '\']/../td/a/span[2][normalize-space(text()) = \'Detail\']/..'), ReferenceError: "retry" is not defined in <eval> at line number 1
com.intuit.karate.exception.karate exception:TC_C.功能:18-javascript评估失败:重试(203000)。单击('/*[normalize space(text())=\''++compName+'\'\']/../td/a/span[2][normalize space(text())=\'Detail\']/..),引用错误:“重试”未在第1行定义
这似乎是麻烦与重试,我不知道如何运行它没有错误

我在不同的地方尝试过,但是重试会出现问题,即使没有分离到更多的场景,它也能正常工作。。如果没有拆分为两个场景,并且只有一个场景存在,那么一切正常

我之所以这么做是因为我想拥有包括多个场景(大纲场景或标准场景)的功能

如果你有任何想法,我会很高兴的。
谢谢。

click()的参数似乎非常复杂,我确信它的引号嵌套错误。所以,请尝试解决这个问题

例如,这不起作用吗:

* retry(20, 3000).click('{}Detail')

如果您仍然被卡住,请遵循以下过程:

单击(的参数似乎非常复杂,我确信它的引号嵌套错误。所以,请尝试解决这个问题

例如,这不起作用吗:

* retry(20, 3000).click('{}Detail')

如果您仍然被卡住,请按照以下流程操作:

您好,当所有代码都在一个场景中时,代码工作正常。但当我将其分离到更多场景中时,retry()会出现这些问题,我不知道原因(场景是按顺序运行的)。我尝试了几个不同的测试,但仍然存在相同的问题-ReferenceError:“retry”未在中定义。@RadimBukovský看起来您掉进了一个常见的陷阱:您好,当所有代码都在一个场景中时,代码工作正常。但当我将其分离到更多场景中时,retry()会出现这些问题,我不知道原因(场景是按顺序运行的)。我尝试了几个不同的测试,但仍然存在相同的问题-ReferenceError中未定义“重试”。@RadimBukovský看起来您掉进了一个常见的陷阱: