ClassInitialize used to work perfectly fine, I have 2 sections in there 2 class initializers and 2 class cleanups. One of them are always active and the other are commented out because of local testing and production. At first everything was working ok, then I switched the ClassInitialize and ClassCleanup when I went back to testing on my local machine. (Keep in mind all of this code was working fine before separately.) Now when I run all tests it just skips the ClassInitialize and Cleanup and I do have TestContext in there. If anyone has any idea why it would just skip this class I would really appreciate it.
This did happen before and then I created a new class and just copy pasted the code and it worked after that, I don't want to do that every time I switch from production to local.
Most likely it's MsTest framework. Make sure:
1 - the method marked with [ClassInitialize] attribute is static.
2 - the method expects a parameter of type TestContext
.
If the framework doesn't react to the attribute, you can try using [ ModuleInitializer ] attribute.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.