2017-10-17 123 views
0

我試圖運行speflow基於visual studio亞軍的測試,但在vsts得到錯誤。我使用以下vsts測試運行任務:無法使用vstest.console.exe運行specflow測試

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe myassembly.dll 

錯誤:

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types

Retrieve the LoaderExceptions property for more information.

我曾嘗試:

/TestAdapterPath: "Adapterpath"/UseVsixExtensions:True/False(Both option)/Platform:[ platform type ] 

...但都未工作;測試在Visual Studio 2017中工作正常,但仍然無法在CI作業中工作。

+1

您與VSTest結合使用哪個測試跑步者? SpecFlow + Runner,MsTest,XUnit,NUnit? –

+0

@AndreasWillich它是xunit –

+0

它是一個核心測試項目嗎?你能用新項目重現這個問題嗎?將system.debug變量設置爲true,然後隊列構建並在OneDrive上共享詳細信息日誌。 –

回答

0

下面的代碼行幫助我找出了缺失的DLL,現在它的構建需要修復。

try 
    { 
    } 
    catch (System.Reflection.ReflectionTypeLoadException ex) 
    { 
     System.Text.StringBuilder sb = new System.Text.StringBuilder(); 
     foreach (System.Exception exSub in ex.LoaderExceptions) 
     { 
      sb.AppendLine(exSub.Message); 
      System.IO.FileNotFoundException exFileNotFound = exSub as System.IO.FileNotFoundException; 
      if (exFileNotFound != null) 
      { 
       if (!string.IsNullOrEmpty(exFileNotFound.FusionLog)) 
       { 
        sb.AppendLine("Fusion Log:"); 
        sb.AppendLine(exFileNotFound.FusionLog); 
       } 
      } 
      sb.AppendLine(); 
     } 
     string errorMessage = sb.ToString(); 
     throw new System.Exception(errorMessage); 
    }