From: Arti Singh on
This @browser is defined in the login method
@browser=Selenium::Client::Driver.new("localhost", 4444, "*chrome", $url
, 10000);

class CrudDContent<Test::Unit::TestCase
def initialize()
login("browser_name")
end#initialize()

def test_createdc()
assert(@browser.element?($x_xpath))#the test fails at this assert
end#test_createdc()




end#CrudDContent<Test::Unit::TestCase



When ever I run this program, I get the error :

C:/RubyInstall/ruby/lib/ruby/1.8/test/unit/testcase.rb:125:in
`add_assertion': private method `add_assertion' called for nil:NilClass
(NoMethodError)
from C:/RubyInstall/ruby/lib/ruby/1.8/test/unit/assertions.rb:494:in
`_wrap_assertion'
from C:/RubyInstall/ruby/lib/ruby/1.8/test/unit/assertions.rb:61:in
`assert'
from ./content.rb:6:in `test_createdc'
from Driver.rb:8

Can someone take a look, I am out of ideas!
--
Posted via http://www.ruby-forum.com/.

From: Arti Singh on
Fixed, I needed to add the initalize the test methods after I called
them




dc=CrudDContent.new()

def initialize(dc)
super(dc)
end #def initialize(dc)

dc.test_createdc()




Arti Singh wrote:
> This @browser is defined in the login method
> @browser=Selenium::Client::Driver.new("localhost", 4444, "*chrome", $url
> , 10000);
>
> class CrudDContent<Test::Unit::TestCase
> def initialize()
> login("browser_name")
> end#initialize()
>
> def test_createdc()
> assert(@browser.element?($x_xpath))#the test fails at this assert
> end#test_createdc()
>
>
>
>
> end#CrudDContent<Test::Unit::TestCase
>
>
>
> When ever I run this program, I get the error :
>
> C:/RubyInstall/ruby/lib/ruby/1.8/test/unit/testcase.rb:125:in
> `add_assertion': private method `add_assertion' called for nil:NilClass
> (NoMethodError)
> from C:/RubyInstall/ruby/lib/ruby/1.8/test/unit/assertions.rb:494:in
> `_wrap_assertion'
> from C:/RubyInstall/ruby/lib/ruby/1.8/test/unit/assertions.rb:61:in
> `assert'
> from ./content.rb:6:in `test_createdc'
> from Driver.rb:8
>
> Can someone take a look, I am out of ideas!

--
Posted via http://www.ruby-forum.com/.