Forum: Ruby on Rails Rcov: how to write test cases

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fde34ab22ac6ae44693f36b9f7fed41d?d=identicon&s=25 Brijesh Shah (brijesh)
on 2009-02-07 07:12
Hi I am using rcov to generate code coverage. But I don't know how to
write cases  for that...

I have installed rcov gem and and execute rcov test/*.rb command. It
shows me some code coverage in files.

Can anyone  help me by giving example that how to write test cases and
where to write...

Thanks in advance...
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-02-07 07:31
Brijesh Shah wrote:
> Hi I am using rcov to generate code coverage. But I don't know how to
> write cases  for that...
>
> I have installed rcov gem and and execute rcov test/*.rb command. It
> shows me some code coverage in files.
>
> Can anyone  help me by giving example that how to write test cases and
> where to write...
>
> Thanks in advance...

http://thelucid.com/2007/08/24/using-rcov-to-measu...

http://www.ultrasaurus.com/sarahblog/2008/12/rails...
Fde34ab22ac6ae44693f36b9f7fed41d?d=identicon&s=25 Brijesh Shah (brijesh)
on 2009-02-07 08:51
Dharmdip Rathod wrote:
> Brijesh Shah wrote:
>> Hi I am using rcov to generate code coverage. But I don't know how to
>> write cases  for that...
>>
>> I have installed rcov gem and and execute rcov test/*.rb command. It
>> shows me some code coverage in files.
>>
>> Can anyone  help me by giving example that how to write test cases and
>> where to write...
>>
>> Thanks in advance...
>
> http://thelucid.com/2007/08/24/using-rcov-to-measu...
> brijesh

> 
http://www.ultrasaurus.com/sarahblog/2008/12/rails...

Thanks I know this.... but I am not getting how to write test cases
which will related to our definition..

lets take example: test cases for create method in user model  which
check validations ...
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-02-07 10:13
Fde34ab22ac6ae44693f36b9f7fed41d?d=identicon&s=25 Brijesh Shah (brijesh)
on 2009-02-07 10:32
You did not get my point....

I am not getting how to create test cases in test files...like in
test/unit/.rb files...

http://pastie.org/378498

require File.dirname(__FILE__) + '/test_helper'

class UserTest < ActiveSupport::TestCase
  # Replace this with your real tests.
  def test_should_create_user
    ?????
    end
  end
end

what should be write in particular definition and how it will work? so i
can generate other test cases..

Thanks
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-02-07 13:41
will call u
This topic is locked and can not be replied to.