首页 > 解决方案 > 更新 cucumber-groovy 后,我得到“对'PickleStepTestStep'的访问超出其访问权限”

问题描述

在将 cucumber-groovy 从版本更新4.7.1到之后,6.1.2我开始收到错误消息Access to 'PickleStepTestStep' exceeds its access rights。在旧版本中,它在cucumber.api.PickleStepTestStep,现在在io.cucumber.core.runner.PickleStepTestStep

PickleStepTestStep现在看到的是私人课程。

我现在如何获取当前步骤名称?

我如何使用它的示例:

class ErrorLogger {

    List<String> errorHolder = new ArrayList<>()

    PickleStepTestStep currentStepDef

    int currentStepDefIndex = 0

    void setNewStepState(TestCase testCase) {
        List<PickleStepTestStep> stepDefs = testCase.getTestSteps().findAll { it instanceof PickleStepTestStep } as List<PickleStepTestStep>

        currentStepDef = stepDefs.get(currentStepDefIndex)
        newStep = true
        currentStepDefIndex++
    }

    private void addNewStepInfoToList() {
        errorHolder.add('############################################################')
        errorHolder.add('[ERROR] STEP NAME: ' + currentStepDef.getStepText())
        newStep = false
    }
}

我对 TestCase 类有同样的问题。

进口情况如下:

    cucumber_groovy          : "io.cucumber:cucumber-groovy:6.1.2",
    cucumber_junit           : "io.cucumber:cucumber-junit:4.7.1",
    groovy                   : 'org.codehaus.groovy:groovy-all:3.0.5',

标签: groovycucumber

解决方案


推荐阅读