NullReferenceException thrown in BrowserWorkflowPlugin.ShutdownBrowser
October 30, 2020 at 3:11 pm #3547
I’m debugging through Bellatrix.SpecFlow.Web.MSTest.Tests in the templates, and finding that all of the scenarios are failing.
The common exception across all scenarios is a NullReferenceException in the post-scenario cleanup…
Source: CrossBrowserTestingIntegration.feature line 28
Duration: 15 sec
TestCleanup method Bellatrix.SpecFlow.Web.MSTest.Tests.CrossBrowserTestingIntegrationFeature.TestTearDown threw exception. System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object..
BrowserWorkflowPlugin.ShutdownBrowser(IServicesCollection container) line 115
BrowserWorkflowPlugin.PostAfterScenario(Object sender, TestWorkflowPluginEventArgs e) line 88
1 eventHandler, TestOutcome testOutcome, String featureName, String scenarioName, List1 featureTags, List`1 scenarioTags, String message, String stackTrace) line 95
TestWorkflowPluginProvider.PostAfterScenario(TestOutcome testOutcome, String featureName, String scenarioName, List
1 featureTags, List1 scenarioTags, String message, String stackTrace) line 62
BaseSpecFlowHooks.PostAfterScenario(FeatureContext featureContext, ScenarioContext scenarioContext) line 141
BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object arguments, ITestTracer testTracer, TimeSpan& duration)
TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
Looking more closely, in file BrowserWorkflowPlugin.Workflow.cs, the TestWorkflowPluginEventArgs e.Container is not initialised when passed to ShutdownBrowser() from PostAfterScenario(). TestWorkflowPluginEventArgs are initialised in RaiseTestEvent() in TestWorkflowPluginProvider.cs, and the Container member is never initialised.
I demonstrated this behaviour using the source code downloaded from Bellatrix.solutions today (30th October 2020), using Google Chrome 86.0.4240.111 (Official Build) (64-bit) and v22.214.171.124 of Bellatrix.Web.Chrome webdriver, and have not changed any code or the default configuration of the solution.
Perhaps related is that DetermineTestClassFullName() called from InitializeDriverOptions() in BrowserWorkflowPlugin.Workflow.cs is unable to determine the scenario name from the stack trace, so the driverOptions are never initialised.
Is this something that you are able to replicate, or is it perhaps specific to my environment?
October 30, 2020 at 3:15 pm #3548
November 2, 2020 at 3:23 pm #3550
November 3, 2020 at 10:31 am #3557
November 3, 2020 at 10:31 am #3558
November 3, 2020 at 4:35 pm #3561
I downloaded the source zip for Aquila Release 126.96.36.199, and I’m still able to replicate the same behaviour.
Please can I check I’ve got the source code that includes the fix? Zip is 3.186 KB, and only change to BrowserWorkflowPlugin.Workflow.cs is the inclusion of System.Threading and Bellatrix.Logging?
November 3, 2020 at 4:57 pm #3562
There are other changes too. Keep in mind that you cannot run CrossBrowserTesting tests without using the cloud platform’s valid account. The two feature files that are intended to work without specific configuration locally are CommonServicesFeature and NavigateToBELLATRIXOnline… All other tests are related to cloud providers, where you need to provide account data in the config. I tried the tests on the screenshot on two different machines from the same zip you have downloaded.
Attachments:You must be logged in to view attached files.
Co-Founder and CTO Automate The Planet
Inventor Bellatrix Test Automation Framework
November 25, 2020 at 9:52 am #3592
I do appreciate that you’re seeing different results that I am, and that you’ve verified this on two separate machines suggests that it’s perhaps down to my environment that’s causing this issue.
All said, I’m still unable to get any tests to complete successfully when the conditional statement in the PostAfterScenario member of the BrowserWorkflowPlugin class in BrowserWorkflowPlugin.Workflow.cs evaluates to true, and the ShutdownBrowser(e.container); call is made with e.container = NULL, causing a runtime exception.
Does your browser configuration on your test machines include restarting every time or restarting on failures? The Belatrix.SpecFlow.Web.MSTest.Tests that I’m using BrowserBehaviour takes a value of RestartEveryTime, which seems to be the default?
Would be keen to get past this problem so we can start using the Bellatrix framework as part of our ART solution, and hopefully help identify this unexpected Bellatrix behaviour that maybe also frustrating other users. Please shout if I can provide any more replication details to allow you to replicate the same behaviour I’m experiencing.
Many Thanks for your help so far,
November 25, 2020 at 5:10 pm #3593
I am sorry to hear that you still have this issue. We are working for a better fix for it and hopefully, it will go Live next days.
But till then I can suggest a workaround for the problem.
ShutdownBrowser(e.Container); => ShutdownBrowser(ServicesCollection.Current);
It will fix your problem right now, We need some time to test if everything other works like expected with such a change.
For now, it looks fine but we need some more time for the official release, but most probably this will be the official change too.
You must be logged in to reply to this topic.