Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > add_assertion' called for nil:NilClass errror when testing

Reply
Thread Tools

add_assertion' called for nil:NilClass errror when testing

 
 
Arti Singh
Guest
Posts: n/a
 
      10-27-2009
This @browser is defined in the login method
@browser=Selenium::Client:river.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/.

 
Reply With Quote
 
 
 
 
Arti Singh
Guest
Posts: n/a
 
      10-27-2009
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:river.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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Imports errror while attempting Insert ASP .Net 3 03-17-2005 03:32 PM
Forms Authentication errror Sumaira Ahmad ASP .Net 1 10-28-2004 11:47 PM
Re: Server not found errror: when trying to open a file from a directo Curt_C [MVP] ASP .Net 4 07-19-2004 09:17 PM
Errror finding Chris Perl 3 07-01-2004 07:44 PM
Windows 2003 Server crashes with stop errror. Jack MCSE 4 12-11-2003 08:15 AM



Advertisments