用Java访问对象数组中的数据
我目前正在使用Cucumber和Java。我想从用Java访问对象数组中的数据,java,arrays,object,cucumber,Java,Arrays,Object,Cucumber,我目前正在使用Cucumber和Java。我想从ITestResult检索文件的路径 我当前正在检索以下参数: Object[] test = testResult.getParameters(); 然而,我唯一能访问的似乎是第一个对象名,而不是其他任何东西 test = {Object[1]@1492} 0 = {CucumberFeatureWrapper@1493} "Links at EDM Documents View," cucumberFeature =
ITestResult
检索文件的路径
我当前正在检索以下参数:
Object[] test = testResult.getParameters();
然而,我唯一能访问的似乎是第一个对象名,而不是其他任何东西
test = {Object[1]@1492}
0 = {CucumberFeatureWrapper@1493} "Links at EDM Documents View,"
cucumberFeature = {CucumberFeature@1516}
path = "test/01-automation.feature"
feature = {Feature@1518}
cucumberBackground = null
currentStepContainer = {CucumberScenario@1519}
cucumberTagStatements = {ArrayList@1520} size = 1
i18n = {I18n@1521}
currentScenarioOutline = null
我看不到如何在cucumber feature下检索
path=“test/01 automation.feature”
。您是否尝试过类似((CucumberFeatureWrapper)test[0])。getCucumberFeature().getPath()?谢谢,但不幸的是,测试[0]中没有与cucumber相关的内容。我已经编辑了答案。对象
数组的第一个元素是一个CucumberFeatureWrapper
对象,它包含您需要的路径。这很有效!好极了非常感谢。我一点也没看到。