[#4567] Re: What's the biggest Ruby development? — Aleksi Niemel<aleksi.niemela@...>

Dave said:

18 messages 2000/08/23
[#4568] Q's on Marshal — Robert Feldt <feldt@...> 2000/08/23

[#4580] RubyUnit testcase run for different init params? — Robert Feldt <feldt@...> 2000/08/25

[#4584] Re: RubyUnit testcase run for different init params? — Dave Thomas <Dave@...> 2000/08/25

Robert Feldt <feldt@ce.chalmers.se> writes:

[#4623] Re: RubyUnit testcase run for different init params? — Robert Feldt <feldt@...> 2000/08/28

On Sat, 26 Aug 2000, Dave Thomas wrote:

[#4652] Andy and Dave's European Tour 2000 — Dave Thomas <Dave@...>

24 messages 2000/08/30
[#4653] Re: Andy and Dave's European Tour 2000 — matz@... (Yukihiro Matsumoto) 2000/08/30

Hi,

[#4657] Ruby tutorials for newbie — Kevin Liang <kevin@...> 2000/08/30

Hi,

[ruby-talk:04461] Re: Getting started with RubyUnit?

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-08-14 09:21:04 UTC
List: ruby-talk #4461
On 11 Aug 2000, Dave Thomas wrote:

> Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
> 
> > Has anyone written any English docs on getting started with RubyUnit?
> > I expaect there will be lots of information in Dave and Andy's book, 
> > but in the meantime I cannot find much to give me the basic concepts
> > on how to use this.  I had a search with Google for information but
> > didn't see much.
> 
> Sorry - we don't have a chapter on it (umm... maybe we should have)
> but it's pretty straightforward.
> 
> A basic recipe is:
> 
	[...]
OK
> 
> Within each test, use the 'assert' methods to perform a test:
> 
>    assert(boolean, [ optional message])
>    assert_equal(expected, actual [, msg])
	[..]
>    assert_no_exception(*arg) {block}
> 
That is a useful set to have.
> 
> Then, you can also write two instance methods to setup the environment 
> for each test, and to tear it down afterwards (setup and teardown
> respectively).
> 
> 
> As an example, here's some of the code we use to test class Array:
> 
> 
> class TestArray < Rubicon::TestCase
> 
>   def test_00_new
>     a = Array.new()
>     assert_instance_of(Array, a)
>     assert_equal(0, a.length)
>     assert_nil(a[0])
>   end
	[...]
> end
> 
Yes that is clear, and it explains how to test for sensible results in
many cases.  I was thinking that test cases might have to be more
mathematical than that, but that sort of thing is pretty exhaustive, if
suitable examples are chosen.
> 
> (We actually inherit from our own class, Rubicon, which does more
> statistics collection than the basic runit. Rubicon--if the code
> crosses it, we get to take over the world)

:-)  and I thought Rubicon would be a goal directed module for string
processing without using regular expressions... :-)

> 
> Hope this helps.
> 
Yes, it does.
> 
> Dave
> 
> 
	Thank you,
	Hugh



In This Thread

Prev Next