2014-08-28 76 views
1

將此內容發佈到谷歌組織SpecFlow上,但是這裏沒有任何活動,所以我們現在就去。SpecRun.exe在執行測試後掛起60秒

我有一個SpecFlow /硒/ MSBuild項目和我正在一個通過 命令行簡單的場景,這樣的事情:

SpecRun.exe run Default.srprofile "/filter:@%filter%" 

的瀏覽器實例激發起來,斷言完成後,並關閉瀏覽器實例。這 需要約5-10秒。

然而:在此之後,我不得不等待60秒,直到SpecRun進程關閉,給我喜歡的結果:


Discovered 1 tests 
Thread#0: 
0% completed 
Thread#0: S 
100% completed 

Done. 
Result: all tests passed 
Total: 1 
Succeeded: 1 
Ignored: 0 
Pending: 0 
Skipped: 0 
Failed: 0 

Execution Time: 00:01:01.1724989 

我目前假設這是因爲它將測試執行報告寫入磁盤..但我無法弄清楚如何將其關閉... http://www.specflow.org/documentation/Reporting/ 而且,我不明白爲什麼這需要60秒,或者如何進一步調試。

我已經刪除了AfterScenario,並檢查硒驅動程序退出/關閉,並驗證這不是什麼導致問題。

任何人都可以對此有所瞭解嗎?

謝謝

回答

0

耶穌。 BaseStepDefinitions存在嚴重問題。進行了更多的調試,發現BeforeScenario在單次測試中達到了25次。每個單一場景啓動並關閉了25個實例。用乾淨的文件另起爐竈像修正:

[Binding] 
public class BaseStepDefinitions 
{ 
    public static IWebDriver Driver; 

    private static void Setup() 
    { 
     Driver = new ChromeDriver(); 
    } 

    [BeforeFeature] 
    public static void BeforeFeature() 
    { 
     Setup(); 
    } 

    [AfterFeature] 
    public static void AfterFeature() 
    { 
     Driver.Dispose(); 
    } 
} 

我不會發布我的原始文件,因爲它是尷尬。

這是一個類似的問題,幫助我https://groups.google.com/forum/#!topic/specflow/LSt0PGv2DeY