<Environment> element defines your target platform environment.
The following optional attributes are available:
- 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 net50
Net461: .NET 4.6.1 - CLR 4.0 (Default)
Netcoreapp3.1: .NET Core 3.1 - CLR netcore31
Netcoreapp2.1: .NET Core 2.1 - CLR netcore21
- The target platform architecture: x86, x64 or Default (the setting under Test | Test Settings | Default Processor Architecture in Visual Studio).
- Determines the level of thread isolation:
Process: Default for .NET Core and .NET
AppDomain: Default for .NET Framework, available only in .NET Framework
- 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 the
apartmentStateproperty 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.
Multi-Threaded Apartment with a Process isolation:
<Environment apartmentState="MTA" testThreadIsolation="Process"/>