更新黄瓜后-groovy 我得到 "Access to 'PickleStepTestStep' exceeds its access rights"
After updating cucumber-groovy I get "Access to 'PickleStepTestStep' exceeds its access rights"
将 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。
现在如何获取当前步骤名称?
我如何使用它的例子:
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 也有同样的问题 class。
导入如下:
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',
我们应该只将使用的 class 从 cucumber.api.PickleStepTestStep
更改为 cucumber-plugin
的界面:io.cucumber.plugin.event.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。
现在如何获取当前步骤名称?
我如何使用它的例子:
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 也有同样的问题 class。
导入如下:
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',
我们应该只将使用的 class 从 cucumber.api.PickleStepTestStep
更改为 cucumber-plugin
的界面:io.cucumber.plugin.event.PickleStepTestStep