Tuesday, June 17, 2008

Announcing Gallio Alpha 3 Update 3

Here comes the next update to Gallio and MbUnit v3.

This is an interim release with a few new features and updates.

Download here: (link)

New and Noteworthy

ReSharper v4.0 Final Integration

This update now supports the final release of ReSharper v4.0.


MbUnit [Factory] Attribute

Suppose we've got a function like this:


To test it, we'll need some different kinds of objects.

So let's use a factory:


That's quite simple, assuming we only want to use single objects for each run.

But we can do better.  We can also return arrays of objects:


However, this doesn't test the case where the value was null.  In that case, the formatter function is supposed to throw an ArgumentNullException.

We can simulate the behavior of the [ExpectedException] attribute by returning additional metadata along with the data item.  Of course, we can include other metadata too, like test descriptions, and other data.



MbUnit [Repeat] and [ThreadedRepeat] Attributes

Sometimes when testing features with non-deterministic behavior, it's useful to be able to run a test repeatedly.

Use the [Repeat] and [ThreadedRepeat] attributes in MbUnit to run tests sequentially or concurrently.

Since the attribute is a test decorator, it may be used with most any kind of test, including data-driven tests.  It can also be used on fixtures, if you like.


Each run appears as a separate item in the report.  They are considered dynamic test steps that are nested within the test.


CSV Files with Metadata

Several people have requested the ability to include additional metadata in rows that are specified by CSV files using the [CsvData] attribute in MbUnit.

Now you can.

Just enclose the name of the column that contains metadata with '[' and ']' and that column will be exposed as a metadata item whose key is the name of the column.

So given this test:


And this data file:

Item, Price, [ConsumedBy]
Apples, 1.00, Worm
Bananas, 1.50, Monkey
Cookies, 2.00, "Cookie Monster"

We get this output in the report:


Notice that the metadata appears in the report as well as the name of the resource and the line number where the data came from!

Technorati Tags: ,


Yann Trevin said...

Similarly to the contract verifiers in the previous release, the new Factory attribute makes a clever usage of the enumerators. I like it.

Anonymous said...

Does [Factory] work with anonymous classes instead of object arrays? Some times I would prefer anonymous class verbosity to know what argument does what.

Anonymous said...

It seems like you're referencing a different version of xunit than is publicly available from the codeproject site (you're v, and the "earliest" release for download is v, which they're calling 1.0.1). Other than that very small issue it looks great.