In NUnit we use TestFixtureSetUp
what is the equivalent test in MSTest?
Thanks
The Test attribute is one way of marking a method inside a TestFixture class as a test. It is normally used for simple (non-parameterized) tests but may also be applied to parameterized tests without causing any extra test cases to be generated.
MsTest is a native unit testing library that comes with Visual Studio from Microsoft. NUnit is an extra Nuget package that needs to be installed on top and interact with the APIs of Visual Studio. Nunit likely doesn't have direct integration into the native APIs like MsTest does.
This attribute is used inside a TestFixture to provide a common set of functions that are performed just before each test method is called.
NUnit is an open-source unit testing framework for the . NET Framework and Mono. It serves the same purpose as JUnit does in the Java world, and is one of many programs in the xUnit family.
here you can find good table which shows NUnit and MSTest attributes side by side:
https://www.lambdatest.com/blog/nunit-vs-xunit-vs-mstest/
for your answer it's ClassInitialize
attribute
You're looking for the [ClassInitialize]
attribute:
[ClassInitialize] public static void Initialize(TestContext testContext) { ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With