HELP! Parallel Tests not working as expected...

156 views
Skip to first unread message

Darkrod 99

unread,
Aug 25, 2020, 3:14:24 PM8/25/20
to SpecFlow
For some reason when I tried to put my test suite in parallel, the execution process only takes one thread. (Only one browser of 4 that opens). That creates errors. There's something that can help solve that problem? I'm using selenium, specflow 3.0 and Nunit3. I'm using the IOC implementation as well. I'm searching a lot and don't find the answer.

This the hooks code:
    [Binding]
    class UiBaseHooks
    {
        private static WebBrowser _driver;
        private readonly IObjectContainer _objectContainer;
        public UiBaseHooks(IObjectContainer objectContainer)
        {
            this._objectContainer = objectContainer;
        }

        [BeforeFeature]
        public static void BeforeFeature()
        {
            _driver = new WebBrowser();
            _driver.InitBrowser();
        }

        [BeforeScenario]
        public void BeforeScenario()
        {
            _objectContainer.RegisterInstanceAs(_driver);
        }

        [AfterFeature]
        public static void AfterFeature()
        {
            //TODO: implement logic that has to run after executing each scenario
            _driver.Close();
        }
    }
 

xDazedx

unread,
Aug 25, 2020, 4:33:23 PM8/25/20
to SpecFlow

Try changing your BeforeFeature to BeforeScenario and AfterFeature to AfterScenario. 

Darkrod 99

unread,
Aug 25, 2020, 8:53:49 PM8/25/20
to SpecFlow
it doesn't work, is still interfering between each other 

xDazedx

unread,
Aug 25, 2020, 9:00:09 PM8/25/20
to SpecFlow

Darkrod 99

unread,
Aug 25, 2020, 9:21:48 PM8/25/20
to SpecFlow
Yes, I review it like 12 times already hahaha
Annotation 2020-08-25 212041.png
Message has been deleted

SpecFlow Team

unread,
Aug 26, 2020, 2:41:59 AM8/26/20
to SpecFlow
Do you have an .srprofile?
Take a look at the Execution element's testThreadCount attribute. 

Darkrod 99

unread,
Aug 26, 2020, 8:54:19 AM8/26/20
to SpecFlow
No, I don't use specflow+ runner. I use NUnit3

ca5...@gmail.com

unread,
Aug 26, 2020, 10:16:26 AM8/26/20
to SpecFlow

Darkrod 99

unread,
Aug 26, 2020, 10:33:50 AM8/26/20
to SpecFlow
Yes, I already put on the assembly. I downloaded a spec.runner and give it a try. But in the build, it throws an error.  "GenerateFeatureFileCodeBehindTask", there's a workaround but don't know where to put it.  this is the workaround MSBUILDSINGLELOADCONTEXT=1  

ca5...@gmail.com

unread,
Aug 26, 2020, 10:39:49 AM8/26/20
to SpecFlow
Environment variables?

Darkrod 99

unread,
Aug 26, 2020, 10:50:26 AM8/26/20
to SpecFlow
 Yes, it says that is on the build but doesn't know maybe I'm putting it run

Darkrod 99

unread,
Aug 26, 2020, 12:18:40 PM8/26/20
to SpecFlow
Ok, I find it where to put it. But the error   "GenerateFeatureFileCodeBehindTask"  don't dissappear 

SpecFlow Team

unread,
Aug 27, 2020, 1:42:02 AM8/27/20
to SpecFlow
Please choose 1 forum where you want to get help from us! 
I saw you asked the same questions on GitHub too, so the answers are waiting for you there.

Darkrod 99

unread,
Aug 27, 2020, 8:47:27 AM8/27/20
to spec...@googlegroups.com
Yeah sorry. I got desperate, I will only ask a question on the Github page then, Thanks and sorry

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/specflow/495220fa-7afe-423e-b67c-b7110dee4eden%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages