.Net, MbUnit

Duration in MbUnit

Playing with MbUnit I just discovered DurationAttribute for the first time. This attribute sets the maximum time allowed for test to finish execution.

The test below will fail because in Duration attribute we set duration for one second but inside the test we sleep for 2 seconds.

public void DurationFailTest()

Next test will succeed because we don’t sleep at all.

public void DurationSuccessTest()

You can use it with RowTest attribute. Row(0) will succeed and Row(2000) will obviously fail.

[RowTest, Duration(1)]
public void DurationRowTest(int sleepTime)


One thought on “Duration in MbUnit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s