2016-07-19 1 views
1

저는 현재 오이와 자바로 작업하고 있습니다. 파일 경로를 ITestResult에서 검색하고 싶습니다.Java를 사용하여 객체 배열의 데이터에 액세스

나는 현재와 매개 변수를 검색 해요 :

Object[] test = testResult.getParameters(); 

I가 액세스 할 수있는 유일한 방법이 될 최초의 객체 이름과 아무것도를 보일 수있을 것입니다 그러나.

test = {Object[1]@1492} 
    0 = {[email protected]} "Links at EDM Documents View," 
     cucumberFeature = {[email protected]} 
      path = "test/01-automation.feature" 
      feature = {[email protected]} 
      cucumberBackground = null 
      currentStepContainer = {[email protected]} 
      cucumberTagStatements = {[email protected]} size = 1 
      i18n = {[email protected]} 
      currentScenarioOutline = null 

어쨌든 오이 기능으로 path = "test/01-automation.feature"을 검색 할 수 없습니다.

답변

1

((CucumberFeatureWrapper)test[0]).getCucumberFeature().getPath()과 같은 것을 사용해 보셨나요?

+0

감사하지만 불행히도, 시험에 관련된 오이는 아무것도 없습니다 [0]. – Smoeey

+0

내 대답을 편집했습니다. 'Object' 배열의 첫 번째 요소는 필요한 경로가 포함 된'CucumberFeatureWrapper' 객체입니다. –

+1

그게 효과가! 환상적! 고맙습니다! 나는 전혀 보지 못했다. – Smoeey

관련 문제