環境
- Visual Studio 2012 プレミアム更新プログラム 3
- Team Foundation Server 2012 Update 3
- 編集:.NET Framework 4
- DefaultTemplate (DefaultTemplate.11.1.xaml)
- Visual Studio テスト ランナー
- 対象プラットフォーム: X86
- Visual Studio テスト ランナー
問題
2 つの単体テスト アセンブリがあります。
- 拡張テスト
- ユーザーテスト
どちらもMicrosoft Fakes Frameworkを使用します (スタブとシムを使用)。
ユニット テストをローカルで実行すると問題なく動作します(ビルド サーバーにインストールされた Visual Studio でも、4 台の異なるマシンでテストされます)。ただし、ビルド エージェントを使用してビルドすると、一部のユニット テストが例外で失敗します。
Unable to create instance of class UserTests.ClientUserTest. Error: System.TypeLoadException: Could not load type 'WorldDirect.CCM.Shared.Backend.SmartClassic.Fakes.StubClient' from assembly 'WorldDirect.Smart.Backend.Fakes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
またはシムについても同じ:
Test method ExtensionTests.ExtensionTests.UpdateExtensionValidate_NoGrnp_ChecksIpPbxDependencies threw exception: System.TypeLoadExceptio: Could not load type 'WorldDirect.CCM.Shared.Backend.SmartClassic.Fakes.ShimIpPbxRemoteDestination' from assembly 'WorldDirect.Smart.Backend.Fakes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
興味深いのは、散発的に失敗することです。ちょっとした統計を作成しようとしました。
# | Outcome | Comment
19 | 64/64 passed | only 'UserTests'-UnitTests run, 'ExtensionTests' inactive
20 | 37/64 passed | same source code as #19
21 | 64/64 passed | same source code as #19
22 | 64/66 passed | all 'UserTests' run as well as 2 'ExtensionTests', others still inactive; the 2 ExtensionTests failed with ShimIpPbxRemoteDestination-TypeLoadException
23 | 38/65 passed | same source code as #22, notice NOTHING has changed, however 1 unit test was not even run in 'ExtensionTests'; however the second succeeds; all unit tests in 'UserTests' using MS Fakes fail with a StubClient-TypeLoadException
24 | 38/65 passed | same source code as #22
new day - no more luck :-(
1 | 37/64 passed | uncommented the 2 'ExtensionTests', so same code as #19
2 | 37/64 passed | so same code as #1
3 | 64/64 passed | so same code as #1; suddenly they all work again
上記の変更以外に、誰もソース コードを変更していないことに注意してください。
すべてのビルドは、詳細なログ レベルを使用して作成されました。シム診断="true";
明示的に必要なシム/スタブのみが .fakes-file に含まれています (それ以外の場合、MSBUILD は終了コード 1 を使用して失敗していました)。
おそらく誰かがすでに同じ問題を経験しているか、誰かがヒントを持っています。
前もって感謝します