seleniumspecflowspecrun

SpecRun.exe hangs for 60 seconds after test execution


posted this to google groups SpecFlow but there is little or no activity there so here we go.

I have a SpecFlow/Selenium/MSBuild project and I am running one simple scenario through the command line, something like this:

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

The browser instance fires up, the assert is done, and the browser instance closes. This takes about 5-10 seconds.

However: after this, I have to wait for 60 seconds until the SpecRun process closes and gives me the result like:


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

I am currently assuming this is because it is writing the test execution report to disk.. but I can not figure out how to turn this OFF... http://www.specflow.org/documentation/Reporting/ And, I can not figure out why this would take 60 seconds, or how to further debug this.

I have removed the AfterScenario and checked the selenium driver quit/close and verified that is not what is causing the problem.

Can anyone shed some light on this ?

Thank you


Solution

  • Jesus. There was something seriously wrong with the BaseStepDefinitions. Did some more debugging and found that the BeforeScenario was hit 25 times on one single test. 25 instances were launched and closed per 1 single scenario. Fixed by starting all over again with a clean file like:

    [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();
        }
    }
    

    I will not post my original file because it is embarrassing.

    This is a similar problem that helped me https://groups.google.com/forum/#!topic/specflow/LSt0PGv2DeY