question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrated from MSTest v1: AssemblyInitialize method has wrong signature

See original GitHub issue

Description

We are trying to migrate our tests to MSTest v2. Our test assemblies use [AssemblyInitialize] and after migration all our test are failing with the following message:

Method …InitializeAssembly has wrong signature. Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.

Our InitializeAssembly method looks like this:

[AssemblyInitialize]
public static void InitializeAssembly(TestContext context)
{
	// code
}

First of all, it does meet the requirements. Also, I noticed that the actual message in the current version of code looks slightly different.

This makes me think that Visual Studio somehow uses the old MSTest tooling despite the fact that our projects no longer reference Microsoft.VisualStudio.QualityTools.UnitTestFramework and reference MSTest.TestFramework and MSTest.TestAdapter instead.

Environment

We are referencing MSTest packages version 1.1.14. The problem is present both in VS 2017 test runner and ReSharper test runner.

We are also using the old .csproj format. Is it possible that we need to make some additional migration changes in our csproj files?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AbhitejJohncommented, Apr 14, 2017

That’s great news @ivonin .

It seems to me that .runsettings doesn’t support deployment items in any way. Is there a workaround for that?

you can use the DeploymentItemAttribute for that. Adorn this on a TestClass or TestMethod that needs the folder\file deployed.

is it possible to make things more clear when there is such misconfiguration?

We do throw out the following warning in the Output -> Tests pane when these settings are used. Warning : A testsettings file or a runsettings with a ForcedLegacyMode set to true is not supported with the MSTest V2 Adapter.

0reactions
AbhitejJohncommented, Apr 14, 2017

Feel free to file a new issue if you run into other problems with the migration effort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrated from MSTest v1: AssemblyInitialize method has ...
InitializeAssembly has wrong signature. Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext. Our ...
Read more >
What does "Method ...ClassInitialize has wrong signature ...
MyCLIClassTest. ClassInitialize has wrong signature. The method must be static, public, does not return a value and should take a single ...
Read more >
Getting error (MyClassName).MyClassInitialize has wrong ...
(MyClassName).MyClassInitialize has wrong signature. The method must be static, public, does not return a value and should take a single ...
Read more >
Most Complete MSTest Framework Tutorial Using .Net Core
Migration from MSTest V1 to MSTest V2. Annotations in MSTest; Automated browser testing with MSTest Framework & Selenium.
Read more >
What does “Method …ClassInitialize has wrong signature ...
Now, the C# tests all fail with a message like "Method MyCLIClassTest.MyCLIClassTest.ClassInitialize has wrong signature. The method must be static, public, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found