# \[ANN\] Test::Unit 0.1.8

**URL:** <https://rubytalk.org/t/ann-test-unit-0-1-8/4669>\
**Category:** ruby-talk\
**Created:** [12 February 2003 04:48 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669 "2003-02-12T04:48:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathaniel\_Talbott](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@Nathaniel\_Talbott](https://rubytalk.org/u/Nathaniel_Talbott)\
**Post date:** [12 February 2003 04:48 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/1 "2003-02-12T04:48:21Z")

</div>

If you don’t know what Test::Unit is, I’ve included an explanation  
further down. For everyone else, here’s some highlights from the  
ChangeLog (you can read the whole thing at  
[http://testunit.talbott.ws/ChangeLog](http://testunit.talbott.ws/ChangeLog)):

- Added more output options to the console test runner.
- Changed Object#id calls to Object# **id** to remove deprecation  
warnings under 1.7.
- Did a little performance tuning.
- Fixed a problem in stack trace filtering in Error.filter.
- Added the ability to pick the runner when running automatically  
(thanks to Eivind Eklund).
- Fixed debugging support in unit.rb.
- Made the failure caused by running an empty suite clear, consistent,  
and changeable.
- !Removed the return value from Assertions#assert\_match.
- Modified tests to make sure all assertions are returning nil unless  
they’re explicitly supposed to do something else.
- !Made TestCase#initialize throw :invalid\_test if the test method  
specified does not exist (this is in addition to the arity check that  
was already in place).
- !Changed #assert\_match to use #=~ instead of #match; it can now  
handle strings as patterns, too.
- Fixed warnings under 1.8 caused by not using a 0 before the decimal  
point of floats.

Notes:

- Test::Unit has been imported in to ruby 1.8. If you’re running  
against the latest CVS, you shouldn’t need to download this!

README:  
Unit testing is making waves all over the place, largely due to the fact  
that it is a core practice of XP. While XP is great, unit testing has  
been around for a long time and has always been a good idea. One of the  
keys to good unit testing, though, is not just writing tests, but having  
tests. What’s the difference? Well, if you just _write_ a test and throw  
it away, you have no guarantee that something won’t change later which  
breaks your code. If, on the other hand, you _have_ tests (obviously you  
have to write them first), and run them as often as possible, you slowly  
build up a wall of things that cannot break without you immediately  
knowing about it. This is when unit testing hits its peak usefulness.

Enter Test::Unit, a framework for unit testing in Ruby, helping you to  
design, debug and evaluate your code by making it easy to write and have  
tests for it.

Grab the fun at [http://testunit.talbott.ws/](http://testunit.talbott.ws/).

Happy testing,

Nathaniel

\<:((\>\<

- 
  - 
    - 

> **···**
>
> > RoleModel Software, Inc.  
> > EQUIP VI

---

<div class="post-metadata">

**Author:** ![Daniel\_Carrera](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@Daniel\_Carrera](https://rubytalk.org/u/Daniel_Carrera)\
**Post date:** [12 February 2003 04:56 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/2 "2003-02-12T04:56:16Z")

</div>

I’m not familiar with Test::Unit. I’m certainly familiar with software source  
comming with a set of tests that you are supposed to run. Is that what this is?

What does this have to do with XP? Do you mean Windows XP? If so, what makes it  
different from the test suites that I’ve been using before XP came out?

> **···**
>
> > README:  
> > Unit testing is making waves all over the place, largely due to the fact  
> > that it is a core practice of XP. While XP is great, unit testing has  
> > been around for a long time and has always been a good idea. One of the  
> > keys to good unit testing, though, is not just writing tests, but having  
> > tests. What’s the difference? Well, if you just _write_ a test and throw  
> > it away, you have no guarantee that something won’t change later which  
> > breaks your code. If, on the other hand, you _have_ tests (obviously you  
> > have to write them first), and run them as often as possible, you slowly  
> > build up a wall of things that cannot break without you immediately  
> > knowing about it. This is when unit testing hits its peak usefulness.
> > 
> > Enter Test::Unit, a framework for unit testing in Ruby, helping you to  
> > design, debug and evaluate your code by making it easy to write and have  
> > tests for it.
> > 
> > Grab the fun at [http://testunit.talbott.ws/](http://testunit.talbott.ws/).
> > 
> > Happy testing,
> > 
> > Nathaniel
> > 
> > \<:((\>\<
> > 
> > - 
> > - 
> > - 
> > 
> > > RoleModel Software, Inc.  
> > > EQUIP VI
> 
> –  
> Daniel Carrera  
> Graduate Teaching Assistant. Math Dept.  
> University of Maryland. (301) 405-5137

---

<div class="post-metadata">

**Author:** ![Matt\_Armstrong](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Matt\_Armstrong](https://rubytalk.org/u/Matt_Armstrong)\
**Post date:** [12 February 2003 06:21 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/3 "2003-02-12T06:21:14Z")

</div>

[nathaniel@NOSPAMtalbott.ws](mailto:nathaniel@NOSPAMtalbott.ws) writes:

> If you don’t know what Test::Unit is, I’ve included an explanation  
> further down. For everyone else, here’s some highlights from the  
> ChangeLog (you can read the whole thing at  
> [http://testunit.talbott.ws/ChangeLog](http://testunit.talbott.ws/ChangeLog)):
> 
> - Did a little performance tuning.

This is great! In my case, Test::Unit is now only a tiny bit slower  
than RubyUnit (still using the RubyUnit compatibility layer). It used  
to

I have two suggested patches to the console ui. The “Finished in  
 seconds” includes to much precision in the seconds (nobody cares  
if it finished in 10.3234323 rather than 10.3234322 seconds), and the  
console runner never flushes io when it prints out the progress dots  
so they don’t function as progress indicators.

— lib/test/unit/ui/console/testrunner.rb Tue Feb 11 21:22:33 2003  
+++ /home/matt/pkg/stow/ruby-cvs/lib/ruby/1.8/test/unit/ui/console/testrunner.rbTue Feb 11 23:14:10 2003  
@@ -90,7 +90,8 @@

```
       def finished(elapsed_time)
         nl

```

- 

```
       output("Finished in #{elapsed_time} seconds.")

```

- 

```
       output("Finished in %.2f seconds." % 

```

- 

```
              [elapsed_time])
       @faults.each_with_index do |fault, index|
         nl
         output("%3d) %s" % [index + 1, fault.long_display])

```

@@ -118,7 +119,10 @@  
end

```
       def output_single(something, level=NORMAL)

```

- 

```
       @io.write(something) if (output?(level))

```

- 

```
       if (output?(level))

```

- 

```
         @io.write(something)

```

- 

```
         @io.flush

```

- 

```
       end
     end
     
     def output?(level)

```

> **···**
>
> –  
> matt

---

<div class="post-metadata">

**Author:** ![Bruce\_Williams](https://avatars.discourse-cdn.com/v4/letter/b/d9b06d/32.png) [@Bruce\_Williams](https://rubytalk.org/u/Bruce_Williams)\
**Post date:** [12 February 2003 05:00 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/4 "2003-02-12T05:00:38Z")

</div>

> What does this have to do with XP? Do you mean Windows XP? If so, what  
> makes it different from the test suites that I’ve been using before XP came  
> out?

eXtreme programming-- follow the link below:

[http://www.xprogramming.com/xpmag/whatisxp.htm](http://www.xprogramming.com/xpmag/whatisxp.htm)

> I’m not familiar with Test::Unit. I’m certainly familiar with software  
> source comming with a set of tests that you are supposed to run. Is that  
> what this is?

You’ll notice TDD (Test Driven Development) listed in the list of XP practices  
via the link.

Hope this helps-- // Bruce

> **···**
>
> On Tuesday 11 February 2003 11:56 pm, Daniel Carrera wrote:
> 
> –  
> Bruce R. Williams :: [iusris/#ruby-lang] :: [http://www.codedbliss.com](http://www.codedbliss.com)
> 
> ‘It does not require a majority to prevail, but rather an irate,  
> tireless minority keen to set brush fires in people’s minds.’  
> – Samuel Adams

---

<div class="post-metadata">

**Author:** ![Bil\_Kleb3](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@Bil\_Kleb3](https://rubytalk.org/u/Bil_Kleb3)\
**Post date:** [12 February 2003 11:36 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/5 "2003-02-12T11:36:27Z")

</div>

Matt Armstrong wrote:

> The “Finished in seconds” includes to much precision in the seconds  
> (nobody cares if it finished in 10.3234323 rather than 10.3234322 seconds)

Actually I do: that is the only way I can tell that it re-ran sometimes  
when I use \C-c \C-c in emacs to re-run the tests. Otherwise, I’ll need  
a date stamp or some such.

> **···**
>
> –  
> Bil Kleb  
> NASA Langley Research Center  
> Hampton, Virginia, USA

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Talbott](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@Nathaniel\_Talbott](https://rubytalk.org/u/Nathaniel_Talbott)\
**Post date:** [13 February 2003 03:57 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/6 "2003-02-13T03:57:01Z")

</div>

> This is great! In my case, Test::Unit is now only a tiny bit  
> slower than RubyUnit (still using the RubyUnit compatibility  
> layer). It used to

Was the rest of what you were going to say interesting? 😉

> I have two suggested patches to the console ui. The  
> “Finished in seconds” includes to much precision in the  
> seconds (nobody cares if it finished in 10.3234323 rather  
> than 10.3234322 seconds), and the console runner never  
> flushes io when it prints out the progress dots so they don’t  
> function as progress indicators.

Both of these patches will be applied. Thanks!

Nathaniel

\<:((\>\<

- 
  - 
    - 

> **···**
>
> Matt Armstrong [[mailto:matt@lickey.com](mailto:matt@lickey.com)] wrote:
> 
> > RoleModel Software, Inc.  
> > EQUIP VI

---

<div class="post-metadata">

**Author:** ![Daniel\_Carrera](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@Daniel\_Carrera](https://rubytalk.org/u/Daniel_Carrera)\
**Post date:** [12 February 2003 05:03 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/7 "2003-02-12T05:03:02Z")

</div>

Thank-you. I was _really_ confused there.  
I’ll read that think. Thanks.

> **···**
>
> On Wed, Feb 12, 2003 at 02:00:38PM +0900, Bruce Williams wrote:
> 
> > eXtreme programming-- follow the link below:
> 
> –  
> Daniel Carrera  
> Graduate Teaching Assistant. Math Dept.  
> University of Maryland. (301) 405-5137

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Talbott](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@Nathaniel\_Talbott](https://rubytalk.org/u/Nathaniel_Talbott)\
**Post date:** [13 February 2003 03:44 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/8 "2003-02-13T03:44:26Z")

</div>

> Matt Armstrong wrote:
> 
> > The “Finished in seconds” includes to much precision  
> > in the seconds (nobody cares if it finished in 10.3234323  
> > rather than 10.3234322 seconds)
> 
> Actually I do: that is the only way I can tell that it re-ran  
> sometimes when I use \C-c \C-c in emacs to re-run the tests.  
> Otherwise, I’ll need a date stamp or some such.

Actually, a date/time stamp sounds like the better, more direct solution  
here. Added to the TODO.

Nathaniel

\<:((\>\<

- 
  - 
    - 

> **···**
>
> Bil Kleb [[mailto:William.L.Kleb@NASA.Gov](mailto:William.L.Kleb@NASA.Gov)] wrote:
> 
> > RoleModel Software, Inc.  
> > EQUIP VI

---

<div class="post-metadata">

**Author:** ![Matt\_Armstrong](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Matt\_Armstrong](https://rubytalk.org/u/Matt_Armstrong)\
**Post date:** [13 February 2003 09:36 UTC](https://rubytalk.org/t/ann-test-unit-0-1-8/4669/9 "2003-02-13T09:36:46Z")

</div>

[nathaniel@NOSPAMtalbott.ws](mailto:nathaniel@NOSPAMtalbott.ws) writes:

> **···**
>
> > Matt Armstrong [[mailto:matt@lickey.com](mailto:matt@lickey.com)] wrote:
> > 
> > > This is great! In my case, Test::Unit is now only a tiny bit  
> > > slower than RubyUnit (still using the RubyUnit compatibility  
> > > layer). It used to
> > 
> > Was the rest of what you were going to say interesting? 😉
> 
> It used to be about 100% slower than RubyUnit, now it is only about  
> 30% slower. Very livable – ~20,000 assertions on a 233 MHz Pentium  
> in 30 seconds (includes my test code running time).
> 
> –  
> matt
