2017-09-19 91 views
1

使用Specrun 1.5.2與Specflow 2.1.0來運行我的測試。我遇到的問題是,使用硒等待很長一段時間(因爲我必須和現在有辦法繞過它),測試一直在中止。當執行硒等待超過10分鐘時Specrun超時測試執行

WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromHours(1)); 
 
       
 
       wait.PollingInterval = TimeSpan.FromMinutes(10); 
 
       wait.Timeout = TimeSpan.FromHours(1); 
 
       //TimeSpan.MaxValue.TotalHours 
 
       wait.IgnoreExceptionTypes(typeof(ThreadAbortException)); 
 
       wait.IgnoreExceptionTypes(typeof(NoSuchElementException)); 
 
      
 
    wait.Until(ExpectedConditions.TextToBePresentInElementLocated(By.XPath($"//*[@data-ths=\"engagement_{EngagementId}\"]/../div[1]/span[2]"), "Ready"));

Whether I run the test from the command line or from within Visual Studio Enterprise using C#, I get the following exception:

TechTalk.SpecRun.Framework.SpecRunException:至少一個測試線程中止。 ---> System.ServiceModel.CommunicationObjectFaultedException:通信對象System.ServiceModel.Channels.ServiceChannel不能用於通信,因爲它處於Faulted狀態。

服務器堆棧跟蹤: 在System.ServiceModel.Channels.CommunicationObject.ThrowIfFaulted() 在System.ServiceModel.Channels.ServiceChannel.Call(字符串動作,布爾單向,ProxyOperationRuntime操作,對象[]項,對象[]奏,時間跨度超時) 在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage包括methodCall,ProxyOperationRuntime操作) 在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即時聊天消息)[0]時

異常重新拋出: 在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & MSGDATA,的Int32類型) 在TechTalk.SpecRun.Framework.IOutProcTestAssemblyExecutor.RunTests(TestThreadState testThreadState) 在TechTalk.SpecRun.Framework.TestThread.Run(ITestExecutionManager executionManagerForRun ) at TechTalk.SpecRun.Framework.AsyncTestThreadRunner.RunSync(TestExecutionManager executionManager) ---內部異常堆棧跟蹤結束--- 結果:測試框架錯誤:至少有一個測試線程中止。 共:1(測試執行:0) 成功:0 忽略:0 未決:0 跳過:0 失敗:0

> Here is my default.srprofile after removing 'apartmentStatew' parameter hoping it would resolve it: 
 

 
<?xml version="1.0" encoding="utf-8"?> 
 
<TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5"> 
 
    <Settings projectName="Symphony.AcceptanceTests" projectId="{04deb5e2-c1a0-4b15-930d-8247c4d4954b}" /> 
 
    <Execution retryFor="None" stopAfterFailures="-1" testThreadCount="3" testSchedulingMode="Sequential" /> 
 
    <!--<Execution retryFor="None" stopAfterFailures="-1" testSchedulingMode="Sequential" />--> 
 
    <Environment testThreadIsolation="Process" /> 
 

 
    <TestAssemblyPaths> 
 
    <TestAssemblyPath>Symphony.AcceptanceTests.dll</TestAssemblyPath> 
 
    </TestAssemblyPaths> 
 
    <DeploymentTransformation> 
 
    <Steps> 
 
     <RelocateConfigurationFile target="CustomConfig{TestThreadId}.config" /> 
 
     <ConfigFileTransformation configFile="Symphony.AcceptanceTests.dll.config" > 
 
     <Transformation> 
 
      <![CDATA[<?xml version="1.0" encoding="utf-8"?> 
 
\t \t \t \t \t \t \t <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
 
           <appSettings> 
 
           <add key="browser" value="{Target}" 
 
           xdt:Locator="Match(key)" xdt:Transform="SetAttributes(value)" /> 
 
           </appSettings> 
 
\t \t \t \t \t \t \t </configuration> 
 
\t \t \t \t \t \t ]]> 
 
     </Transformation> 
 
     </ConfigFileTransformation> 
 
    </Steps> 
 
    </DeploymentTransformation> 
 

 
    <Targets> 
 
    <Target name="Edge"> 
 
     <Filter>Browser_Edge</Filter> 
 
    </Target> 
 
    <Target name="GhostDriver"> 
 
     <Filter>Ghost_Driver</Filter> 
 
    </Target> 
 
    <Target name="Chrome"> 
 
     <Filter>Browser_Chrome</Filter> 
 
    </Target> 
 
    <Target name="Firefox"> 
 
     <Filter>Browser_Firefox</Filter> 
 
    </Target> 
 
    <Target name="Safari"> 
 
     <Filter>Browser_Safari</Filter> 
 
    </Target> 
 
    <Target name="API"> 
 
     <Filter>API</Filter> 
 
    </Target> 
 
    <Target name="IE"> 
 
     <Filter>Browser_IE</Filter> 
 
    </Target> 
 
    </Targets> 
 

 
    <TestThreads> 
 
    <TestThread id="0"> 
 
     <TestAffinity>testPath:Target:Chrome</TestAffinity> 
 
    </TestThread> 
 
    <TestThread id="1"> 
 
     <TestAffinity>testPath:Target:API</TestAffinity> 
 
    </TestThread> 
 
    <TestThread id="2"> 
 
     <TestAffinity>testPath:Target:Edge</TestAffinity> 
 
    </TestThread> 
 
    </TestThreads> 
 
</TestProfile> 
 

 

 
    
 

 

+0

爲什麼您需要在自動化測試中等待超過10分鐘? – JeffC

+0

應用性質。有些東西正在被第三方系統處理,並且在完成該過程之前可能需要一個小時才能完成 – user5199

+0

然後,它聽起來不像是自動化的好候選者。 – JeffC

回答

1

這在SpecFlow一個錯誤+ Runner將在1.6.3版本中修復。