See my template project, the code for test are broken down to use a partial class here and the main test class uses this class.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm running in VS 2022 with .NET Framework 4.8
I'm referencing NuGet packages MsTest.TestAdapter and MsTest.TestFramework 2.2.10.
I'm getting this error for a lot of tests
(MyClassName).MyClassInitialize has wrong signature. The method must be static, public, does not return a value and should take a single parameter of type TestContext.
The class does have the correct signature:
[ClassInitialize()]
public static void MyClassInitialize(TestContext context)
{
...
}
It runs ok locally but when it runs in the build many tests fail with this error. Any ideas what might be causing this?
See my template project, the code for test are broken down to use a partial class here and the main test class uses this class.
This isn't really an answer but it is how I fixed the problem - I rewote the tests in xUnit and used IClassFixture<T> instead of ClassInitialize.
I got this error when adding a new test class file to an existing unit test project. It was a copy/paste of an existing one and the original still works. The new one though, gets this error. Even though it is identical to what the error says it should be... So, the best way to resolve this is to use a different unit test library? Way to go Microsoft.