add_assertion' called for nil:NilClass errror when testing

A

Arti Singh

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!
 
A

Arti Singh

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top