I was sort of able to reproduce your problem, though in my case I could not get either vstest.console.exe test.dll
or dotnet vstest test.dll
to work. they both just spat out the same error about no tests being available.
Issue reproduction:
- Use NUnit as the testing framework.
Fix:
- Add a reference to
Nunit3TestAdapter
in packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.12.0" targetFramework="net46" />
<package id="NUnit3TestAdapter" version="3.16.1" targetFramework="net46" developmentDependency="true" />
</packages>
- Rebuild the solution.
Then both of the commands vstest.console.exe test.dll
and dotnet vstest test.dll
worked as expected.
If you are using a different testing framework than NUnit, there ought to be a corresponding adapter to serve the same purpose.
I have verified that this works for MSTest as well.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net46" />
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net46" />
</packages>