0
내 애플리케이션 테스트를 위해 Radrails에서 watir을 사용합니다. 내 테스트에서는 두 개의 클래스를 사용하는데 여기서 변수 @ie도 사용합니다.정의되지 않은 지역 변수 또는 메쏘드 'ie1'이 메인
일등석 : 다음은 두 클래스의 코드는
class Title
def initialize(title,url,ie)
@title = title
@url=url
@ie=ie
@ie=Watir::IE.attach(:title, @title)
rescue Watir::Exception::NoMatchingWindowFoundException
puts ("could not find browser")
$r.addtoReport(testReport, "check page element", "FAILED", "Page title " + @title +" not found")
else
@ie=Watir::IE.attach(:url, @url)
end
end
2 등석 :
나중에 내가 이들과 같은 명령을 실행 테스트 몸에class Text_pos
def initialize(text, object,ie)
@text=text
@object=object
@ie=ie
if @ie.contains_text(@text)
puts("Test for " + @object + " passed")
$r.addtoReport($testReport, "check " + @object, "PASSED", "Test for " + @object + " passed")
else
puts("Test for " + @object + " failed")
puts (@ie.link(:text => /Exception:/))
h= @ie.link(:text => /Exception:/)
$r.addtoReport($testReport, "check " + @object, "FAILED", h.text)
end
end
end
:
Text_pos.new("Glossary Of Terms", "login",ie)
Title.new("Company","http://ec2-50-16-62-110.compute-1.amazonaws.com:9100/bobsworld/BPM/Mtebpm000p0001Form.do?resetFilter_action=", ie1)
Text_pos.new("Title", "if page is loaded", ie1)
을
하지만 오류가 발생했습니다 : Test for login passed BPM/try.rb:106:in
': 정의되지 않은 로컬 변수 또는 방법젤 이코 필리핀의 의견에 부연
코드를 올바르게 들여 씁니다. – tokland
"test body"에서 ie1 변수를 정의하지 않으므로 nil입니다. –
우선 코드를 정리해야합니다. 즉, @ ie = ie/ @ Watir :: IE.attach (: title, @title) 및 즉 ie = 합리적인 의미는 아닙니다. –