2014-04-05 20 views
9

Xunit.net'i Visual Studio Online tarafından barındırılan yapıyla kullanıyorum. Testlerim keşfediliyor ve hem yerel olarak hem de sunucu üzerinde çalışıyor. Ancak, yapı sunucusunda bu özel durumu alıyorum (yapının "Kısmen Başarılı" durumuna ulaşmasına neden oluyor). Bu garip, çünkü bütün testlerim aslında keşfediliyor ve çalışıyor.Visual Studio Online build server ile xUnit.net testlerini keşfetme özel durum

[xUnit.net 00:00:01.3170293] Exception discovering tests from C:\a\bin\xunit.runner.visualstudio.testadapter.dll: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 
File name: 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 
File name: 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 

WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value HKLM\Software\Microsoft\Fusion!EnableLog to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

    at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) 
    at System.Reflection.RuntimeAssembly.GetExportedTypes() 
    at Xunit.Sdk.Executor.EnumerateTests..ctor(Executor executor, Object _handler)$$RethrowMarker$$ at ExceptionExtensions.RethrowWithNoStackTraceLoss(Exception ex) 
    at Xunit.RemoteAppDomainManager.CreateObjectTObject 
    at Xunit.Xunit1Executor.EnumerateTests(ICallbackEventHandler handler) 
    at Xunit.Xunit1.Find(Predicate`1 filter, Boolean includeSourceInformation, IMessageSink messageSink) 
    at Xunit.Xunit1.Find(Boolean includeSourceInformation, IMessageSink messageSink) 
    at Xunit.XunitFrontController.Find(Boolean includeSourceInformation, IMessageSink messageSink) 
    at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.GetTests(IEnumerable`1 sources, IMessageLogger logger, XunitVisualStudioSettings settings, Stopwatch stopwatch) 

See http://go.microsoft.com/fwlink/?LinkId=254169 

aşağıdaki Nuget paketler testi projesinde yüklediniz:

  • xunit 1.9.2
  • xunit.runner.visualstudio 0.99.2

Diğer birim test çerçeveler MS Test ve NUnit gibi, sorunsuz çalışıyorlar. Bu bana sorun Visual Studio Online yerine Xunit.net ile olduğunu düşünüyorum.

Ayrıca xUnit.net GitHub'da bir sorun açtım, ancak çözülmedi. https://github.com/xunit/xunit/issues/47

Bu çalışmayı nasıl sağlayabilirim? Bir geçici çözüm bilen var mı? Hata mesajını bir şekilde bastırabilir miyim?

cevap

15

Testcherner, birim testlerini xunit.runner.visualstudio.testadapter.dll'da keşfetmeye çalışır. Niye ya? Çünkü *.test*.dll'un varsayılan test kaynaklarının özellikleriyle eşleşiyor.

Varsayılan sınama kaynağı belirtimlerini *.tests.dll veya başka bir şey için değiştirirken, daha sonra çalışır.

Kaynak: http://erictummers.wordpress.com/2014/02/11/execute-xunit-tests-on-hosted-build-controller/

+4

benim Visual Studio Çevrimiçi yapı ile NUnit Testi Adaptörü kullanarak ve aynı zamanda düzelttim Yukarıdaki önerildiği gibi joker adlandırma benzer bir durum geldi. Aldığım hata iletisi: 'Bağımlı Derleme Microsoft.VisualStudio.TestPlatform.ObjectModel, Sürüm = 11.0.0.0, Kültür = nötr, PublicKeyToken = b03f5f7f11d50a3a C: \ a \ bin \ NUnit.VisualStudio.TestAdapter.dll bulunamadı. NUnit projesi olmasa bile göz ardı edilebilir. Umarım bu, NUnit dışında bu konuya rastlayan başka birine yardımcı olabilir. –

İlgili konular