Environment¶
The <Environment>
element defines your target platform environment.
Attributes¶
The following optional attributes are available:
framework
¶
- The .NET framework in use. SpecFlow+ determines which CLR (Command Language Runtime) version to use to execute the tests based on these setting:
Net5.0
: .NET 5.0 - CLR net50Net461
: .NET 4.6.1 - CLR 4.0 (Default)Netcoreapp3.1
: .NET Core 3.1 - CLR netcore31Netcoreapp2.1
: .NET Core 2.1 - CLR netcore21
platform
¶
- The target platform architecture: x86, x64 or Default (the setting under Test | Test Settings | Default Processor Architecture in Visual Studio).
testThreadIsolation
¶
- Determines the level of thread isolation:
Process
: Default for .NET Core and .NETAppDomain
: Default for .NET Framework, available only in .NET FrameworkSharedAppDomain
apartmentState
¶
- Sets the apartment state used to execute the tests:
STA
: Single Threaded Apartment. Use this if your application is not thread-safe.MTA
: Multi-Threaded Apartment.Unknown
: The ApartmentState is not set; tests run in same thread as SpecFlow+. (default)
Note: Setting theapartmentState
property does not set the test thread apartment state on Linux and OSX. ApartmentStates are not supported on non-Windows systems because COM interop is only available on Windows. Please refer to Microsoft’s documentation for more information.
Example¶
Multi-Threaded Apartment with a Process isolation:
<Environment apartmentState="MTA" testThreadIsolation="Process"/>