2014-04-05 22 views
9

Tôi đang sử dụng Xunit.net với Visual Studio Online được lưu trữ trên máy chủ. Các thử nghiệm của tôi đang được phát hiện và chạy tốt cả cục bộ lẫn trên máy chủ xây dựng. Nhưng trên máy chủ xây dựng, tôi nhận được ngoại lệ này (gây ra việc xây dựng để đạt được trạng thái "Thành công một phần"). Điều này là kỳ lạ, vì tất cả các bài kiểm tra của tôi trên thực tế đang được phát hiện và chạy.Ngoại lệ khám phá các kiểm tra xUnit.net với máy chủ tạo Visual Studio Online

[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 

Tôi đã gói NuGet sau được cài đặt trong dự án thử nghiệm:

  • xUnit 1.9.2
  • xunit.runner.visualstudio 0.99.2

Khác khuôn khổ kiểm tra đơn vị , chẳng hạn như MS Test và NUnit, đang hoạt động không có vấn đề gì. Điều này làm cho tôi nghĩ rằng vấn đề là với Xunit.net hơn là với Visual Studio trực tuyến.

Tôi cũng đã mở một vấn đề tại xUnit.net GitHub, nhưng nó vẫn chưa được giải quyết. https://github.com/xunit/xunit/issues/47

Làm cách nào để làm việc này? Có ai biết về một workaround? Tôi có thể bằng cách nào đó ngăn chặn thông báo lỗi?

Trả lời

15

Trình thử nghiệm cố gắng khám phá các bài kiểm tra đơn vị trong xunit.runner.visualstudio.testadapter.dll. Tại sao? Bởi vì nó khớp với thông số nguồn thử mặc định của *.test*.dll.

Khi thay đổi thông số nguồn thử nghiệm mặc định thành *.tests.dll hoặc thông tin khác cụ thể hơn, nó sẽ hoạt động.

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

+4

tôi tình cờ gặp một tình huống tương tự sử dụng NUnit thử nghiệm Adapter với Visual Studio của tôi trực tuyến xây dựng và đổi tên các ký tự đại diện như bạn đề nghị ở trên cố định nó là tốt. Các thông báo lỗi tôi đã nhận được: 'Phụ thuộc hội Microsoft.VisualStudio.TestPlatform.ObjectModel, Phiên bản = 11.0.0.0, Văn hóa = trung lập, PublicKeyToken = b03f5f7f11d50a3a của C: \ a \ bin \ NUnit.VisualStudio.TestAdapter.dll không tìm thấy. Có thể bỏ qua nếu không phải là một dự án NUnit.' Hy vọng điều này có thể giúp một người khác tình cờ gặp vấn đề này ngoại trừ NUnit. –

Các vấn đề liên quan