Closed ThiagoDv closed 2 years ago
Could you please provide more information? Like:
This is too less information to say anything except WTF.
Hello, good afternoon, can you tell me where I can get more information about the ObjectContainer class. I already read the documentation available on the site but I didn't find clear information, I need to know what the BaseContainer property means and more about the methods of this class.
BaseContainer is the parent container of the current container. Source is here: https://github.com/SpecFlowOSS/BoDi/blob/master/BoDi/BoDi.cs#L592
Is it normal for the Base Container to be null? If not, how can I start it? I'm getting this error when it tries to go through NUnit.ssemblyHooks
Error says: ObjectContainer name does not exist in current context
If it is the globalcontainer, then yes, it is ok that BaseContainer is null.
Okay, thanks for the feedback, it's helping me a lot in my studies. One last question and I believe this will be the key to unlocking this error I have in TFS when uploading the automated tests.
specrun + runner comes with a TFS ready configuration as described in the TFS documentation. However, the other test provider options do not come with this configuration (specflow.nunit, specflow.xunit, etc), and there is no description about it in the documentation.
My question then is, how do I configure this configuration with the specflow.nunit test provider so that my automated tests run on TFS without this error:
Failed EditarPropostaDeSituacaoIgualAEmDigitacaoNoFormulario [184 ms]
Error Message:
OneTimeSetUp: System.TypeInitializationException : The type initializer for 'BoDi.ObjectContainer' threw an exception.
----> System.Security.VerificationException : Operation could destabilize the runtime.
This error occurs in every scenario of my features, I'll put the log attached here in case you want to take a look.
The final error is this:
Setup failed for test fixture InternetBanking_Tests_NUnitAssemblyHooks
System.TypeInitializationException : The type initializer for 'BoDi.ObjectContainer' threw an exception.
----> System.Security.VerificationException : Operation could destabilize the runtime.
StackTrace: at BoDi.ObjectContainer..ctor(IObjectContainer baseContainer)
at TechTalk.SpecFlow.Infrastructure.ContainerBuilder.CreateGlobalContainer(Assembly testAssembly, IRuntimeConfigurationProvider configurationProvider) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\ContainerBuilder.cs:line 33
at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 213
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder, Boolean createIfMissing) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 201
at TechTalk.SpecFlow.TestRunnerManager.OnTestRunStart(Assembly testAssembly, IContainerBuilder containerBuilder) in D:\a\1\s\TechTalk.SpecFlow\TestRunnerManager.cs:line 230
at InternetBanking_Tests_NUnitAssemblyHooks.AssemblyInitialize()
--VerificationException
at BoDi.ObjectContainer..cctor() in C:\Work\BoDi\BoDi\BoDi.cs:line 594
Thank you in advance for your attention, good work!
Thank you very much for the explanations I managed to solve the problem, apparently because I had steps shared between the features I needed to create a stepbase and put the IObjectContainer in its constructor and make my steps inherit the constructor of this stepsbase class. Now it worked and it's working.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
SpecFlow Version
3.9.74
Which test runner are you using?
NUnit
Test Runner Version Number
3.13.3
.NET Implementation
equal or greater .NET Framework 4.6.1
Project Format of the SpecFlow project
Classic project format using
packages.config
.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
SpecFlow Section in app.config or content of specflow.json
<?xml version="1.0" encoding="utf-8"?>