Ambiente
- Visual Studio 2012 Premium Update 3
- Team Foundation Server 2012 Update 3
- edit: .NET Framework 4
- DefaultTemplate (DefaultTemplate.11.1.xaml)
- Visual Studio test Runner
- Piattaforma di destinazione: X86
- Visual Studio test Runner
Problema
Ho 2 Unit-Test-Assemblee:Microsoft Falsi & TFS 2012 Visual Studio Test Runner - prova falliscano sporadicamente
- ExtensionTests
- UserTests
utilizzano entrambi il framework di Microsoft Fakes (utilizzando Stubs e Shim).
Esecuzione dei test di unità funziona a livello locale bene (testato su 4 macchine diverse, anche sul Visual Studio installato sul server build), se costruiamo con un agente di compilazione, alcuni test di unità fallisce con l'eccezione, ad esempio, :
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'.
o lo stesso per uno spessore:
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'.
la cosa interessante è, non riescono sporadicamente, ho cercato di recuperare un po 'di statistiche:
012.351.641.061.# | 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
Si noti che accanto alle modifiche menzionate nessuno ha modificato il codice sorgente.
Tutte le build sono state create utilizzando un livello di registro dettagliato; Shim Diagnostic = "true";
solo shim/stubs esplicitamente necessari sono inclusi nel file .fakes (otherwhise MSBUILD non riusciva a utilizzare exit-code 1).
Mi sembra tutto abbastanza magico, forse qualcuno ha già avuto gli stessi problemi o qualcuno ha un suggerimento.
Grazie in anticipo
Si prega di inviare un bug con un piccolo progetto che riproduce il problema su http://connect.Microsoft.com/VisualStudio. –
Il bug è aperto, consultare https://connect.microsoft.com/VisualStudio/feedback/details/794458/microsoft-fakes-tfs-2012-visual-studio-test-runner-unit-test-fail-sporadically – shadowrunner
Grazie . Abbiamo iniziato a lavorarci oggi. –