2011/05/10

More About Custom Data Source Attributes

Some weeks ago, I explained how to extend Gallio/MbUnit with custom data source attributes. The principle is to provide convenient and reusable attributes which feed test methods with data coming from an external source (e.g. file, database, distant service, etc.)

Aleksandr Jones has just written a very nice article in his blog that illustrates the concept. He explains how to create an attribute that grabs test parameters from an OLE/SQL database. The typical usage is the following:
[Test]
[CustomAttribute("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=MikeGarage.accdb;Persist Security Info=False;", "Customers")]
public void CustomAttributeTest(DataRow dataRow)
{
// ...
}

No comments: