SUnit
The mother of all unit testing frameworks

News


SUnit Update

New Version, New Site, New URL

Not only is there a new version of SUnit out, the web site has been redesigned, and the site has a new URL.

SUnit 3.1

What's new in SUnit 3.1

SUnit 3.1 includes a various bug fixes, as well as a small number of additions and extensions to SUnit. The reason for the release's delay has been the lack of time available to devote to the project, and the problems associated with creating a clean, dialect-independent code base.

SUnit Camp Smalltalk is still available in four parts:

This is a list of the changes made to each module.

SUnitPreload

SUnit Core

The SUnit core package has achieved the goal of having the exact same code for all dialects - almost. The only dialect using a variant code base is Object Studio. Other than that, the changes consist of additions and bug fixes.

Additions

1. Assertion description strings

The TestCase assertion protocol has been extended with a number of methods allowing the assertion to have a description.. These methods take a String as second argument. If the test case fails, this string will be passed along to the exception handler, allowing more variety in messages than "Assertion failed" gives you. Of course, this string can be constructed dynamically.

    | e |
    e := 42.
    self assert: e = 23 description: 'expected 23, got ' e printString

The added methods in TestCase are:

2. Logging support

The description strings described above may also be logged to a Stream such as the Transcript, a file, stdout etc. You can choose whether to log by overriding TestCase>>#isLogging in your test case class, and choose where to log to by overriding TestCase>>#failureLog.

3. ResumableTestFailure

A resumable TestFailure has been added. What can this be used for? Take a look at this example:

aCollection do: [ :each | self assert: each isFoo]

In this case, as soon as the first element of the collection isn't Foo, the test stops. In most cases, however, we would like to continue, and see both how many elements and which elements aren't Foo. It would also be nice to log this information. You can do this in this way:

aCollection do: [ :each |
      self
          assert: each isFoo
          description: each printString, 'is not Foo'
          resumable: true]

This will print out a message to your logging device for each element that fails. It doesn't cumulate failures, i.e., if the assertion fail 10 times in your test method, you'll still only see one failure.

Bug fixes

SUnitTests

SUnitUI

SourceForge.net Logo