# Coverage!

**URL:** <https://www.ruby-forum.com/t/coverage/131617>\
**Category:** Ruby\
**Created:** [May 23, 2007, 1:34pm UTC](https://www.ruby-forum.com/t/coverage/131617 "2007-05-23T13:34:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![koustubh\_joshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@koustubh\_joshi](https://www.ruby-forum.com/u/koustubh_joshi)\
**Post date:** [May 23, 2007, 1:34pm UTC](https://www.ruby-forum.com/t/coverage/131617/1 "2007-05-23T13:34:42Z")

</div>

Hi,

Am trying to run my ruby files in rcov task,

here is the code, am using,

begin  
require ‘rcov/rcovtask’

Rcov::RcovTask.new do |t|

```
t.test_files = FileList["/**/TestCase/*.rb"]
t.verbose = true

```

end  
rescue LoadError  
puts ‘Rcov is not available.’  
end

There are many .rb files in that TestCase folder but it is showing the  
coverage of only one file…

Will you plz help me, how i can get covrage of all .rb files.

---

<div class="post-metadata">

**Author:** ![koustubh\_joshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@koustubh\_joshi](https://www.ruby-forum.com/u/koustubh_joshi)\
**Post date:** [May 23, 2007, 2:00pm UTC](https://www.ruby-forum.com/t/coverage/131617/2 "2007-05-23T14:00:52Z")

</div>

On 5/23/07, Koustubh J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Will you plz help me, how i can get covrage of all .rb files.  
> Please, before reposting the same question, first see the answers you  
> have already got [1] and comment on them.

J.

[1] [Rcov Task - Ruby - Ruby-Forum](http://www.ruby-forum.com/topic/108893#248556)

---

<div class="post-metadata">

**Author:** ![koustubh\_joshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@koustubh\_joshi](https://www.ruby-forum.com/u/koustubh_joshi)\
**Post date:** [May 23, 2007, 2:23pm UTC](https://www.ruby-forum.com/t/coverage/131617/3 "2007-05-23T14:23:04Z")

</div>

Jano S. wrote:

> On 5/23/07, Koustubh J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Will you plz help me, how i can get covrage of all .rb files.  
> > Please, before reposting the same question, first see the answers you  
> > have already got [1] and comment on them.
> 
> J.
> 
> [1] [Rcov Task - Ruby - Ruby-Forum](http://www.ruby-forum.com/topic/108893#248556)

I tried the options that u have specified, but it showing coverage for  
only one test script that is last one…

Could u plz help me solve it…

thankx…

---

<div class="post-metadata">

**Author:** ![koustubh\_joshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@koustubh\_joshi](https://www.ruby-forum.com/u/koustubh_joshi)\
**Post date:** [May 23, 2007, 2:36pm UTC](https://www.ruby-forum.com/t/coverage/131617/4 "2007-05-23T14:36:59Z")

</div>

On 5/23/07, Koustubh J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I tried the options that u have specified, but it showing coverage for  
> only one test script that is last one…
> 
> Could u plz help me solve it…

Ok,

1. do your test scripts have name tc\_something.rb or test\_something.rb?  
if yes, they do not appear in rcov by design. Try plaing with  
–include-file or --exclude-only parameters to rcov

2. Check your FileList by adding  
puts t.test\_files just after the assignment

This is how my RCovTask looks like (I’m using fixed array of test  
files, as I don’t want to run each of them. Now I don’t remember any  
more why I have put --aggregate there.

Rcov::RcovTask.new do |t|  
t.test\_files = FileList[\*SHORT\_TESTS]  
t.output\_dir = RCOV\_OUTPUT

```
    t.rcov_opts = [
            "--sort coverage",
            "--sort-reverse",
            "--include-file /\btc_[^.]*\.rb/",
            "--aggregate #{RCOV_DATABASE}"
    ]

```

end

J.
