2

TeamCityを使用して、テストと本番の自動ビルドを実行しています。TeamCityは、Gallioを使用したプロセスの最後に、mbUnit3.1テストを実行します。

テストビルドを実行するとき、Gallioはテストデータベースサーバーに対してテストを実行しようとする必要があります。ただし、本番ビルドを実行する場合、TeamCityは本番データベースサーバーにアクセスできないため、これらのテストは実行しないでください(本番データベースが利用可能であっても、多くのテストはリリースされていないコードで失敗します)。

IsDBOnlineなどのブール値に基づいてmbUnitで無視されるように、テストにマークを付けるにはどうすればよいですか?

4

1 に答える 1

3

Create a subclass of TestDecoratorAttribute and override the Initialize() method to check IsDBOnline and call Assert.Inconclusive() if false.

Another way to achieve a similar effect is to add a [Category] attribute to the tests that use the Db and then filter them out when running the tests on production.

于 2009-08-14T20:54:09.370 に答える