Coverage-Gutter extension for visual studio code is not showing line coverage - .NET - unit-testing

For .net unit testing I installed Coverage Gutter in visual studio code.
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters.
But is not showing the line coverage.
when I press Coverage Gutter display coverage or press the "watch" option in the footer it says "Could not find coverage file"
Error:
Could not find a Coverage file! Searched for lcov.info, cov.xml, coverage.xml, jacoco.xml, coverage.cobertura.xml
my setting.json
{
"dotnet-test-explorer.testProjectPath": "**/*test.csproj",
"dotnet-test-explorer.runInParallel": true,
"coverage-gutters.showLineCoverage": true,
"dotnet-test-explorer.testArguments": "/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=../../lcov.info",
"coverage-gutters.coverageBaseDir": "**",
"coverage-gutters.coverageFileNames": [
"lcov.info",
"cov.xml",
"coverage.xml",
"jacoco.xml",
"coverage.cobertura.xml"
]
}
I think the issue is in "coverage-gutters.coverageBaseDir": "**",
Can anyone help me to fix the issue?

Related

Visual Studio 2017 JavaScript Language Service has been disabled

While editing JavaScript source files in Visaul Studio 2017, the following error keeps occuring:
The JavaScript language service has been disabled for the following project(s): ...
Even if I disable the JavaScript language service entirely, the error keeps occuring. Why is this happening and how do I stop this error message from displaying all the time? Can I disable the JavaScript language service entirely?
The solution to the problem was simply to use a tsconfig.json file, even though there were only JavaScript files in my solution.
I've just used the following tsconfig.json file in the root of the project:
{
  "compileOnSave": true,
 "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "sourceMap": true,
    "target": "es2015",
    "module": "amd",
    "allowJs": false,
    "allowSyntheticDefaultImports": true
  },
  "exclude": [
    "lib",
    "node_modules"
  ]
}
open 'developer command line tool for visual studio'. run :
devenv.exe /resetuserdata

Turning off "Language Service Disabled" error message in VS2017

We are getting the following "Error" message in our MVC web application in Visual studio 2017 Enterprise.
The language service is disabled for project 'C:\Work\Blackhawk
Platform\Platform-DEV-Branch\BlackhawkViewer\BlackhawkViewer.csproj'
because it included a large number of .js files. Consider excluding
files using the 'exclude' section of a 'tsconfig.json' file.
I have tried turning off the Language service in the options but this does not turn the message off:
This is a rather large web application. Is there a way to turn this message off without disabling any files in the tsconfig.json file as it suggests?
To solve this issue do the following:
Create file in root directory of your project and call it tsconfig.json
Add this:
{
"compilerOptions": {
"allowJs": true,
"noEmit": true,
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"include": [
"scripts"
],
"exclude": [
],
"typeAcquisition": {
"enable": true
}
}
Please have a look at the below two links for tsconfig.json explanation, because you may still need to change it according to your setup. This is the only way that worked for me. I hope that will help.
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
https://developercommunity.visualstudio.com/content/problem/8148/javascript-intellisense-not-working.html
This helped me. You can have a try.
Go to Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service -> General
and uncheck the box: "Enable the new JavaScript language service.
I have found a solution for this problem.
I reset my userData using:
devenv.exe /resetuserdata
Since doing this the JavaScript settings seem to have persisted and I no longer get the language service error above.
TAKE NOTE: This will reset all your user data and customisations.
In My case I just disable TypeScript support on Visual Studio:
Tools > Extensions and Updates > TypeScript for Microsoft Visual Studio > Disable
After that, just restart Visual Studio, and you are good to go.
Hope this will help,
I had the same problem after migrating Ionic 1 project from VS2015 to VS2017, first I executed git clean -fxd as sugested above and added this content into tsconfig.json in my ionic project.
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"www",
"bower_components"
]
}
I solved this problem with following solution:
When you have a JavaScript file that is included in the project.csproj file but isn't in the project folder, this error occurred.
For example I have a .csproj file like below:
<ItemGroup>
<Content Include="Scripts\Test.js" />
</ItemGroup>
The Test.js is included in the .csproj file, but it isn't in the Scripts folder:
Delete the <Content Include="Scripts\Test.js" /> line from the .csproj file and rebuild your project
Solution that worked for me:
Go to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>.
Open command prompt as admin in current folder
Ran devenv /Setup
Ran devenv /ResetSkipPkgs
For me is helping the next solution. I've create a tsconfig.json file in root of the my project with "disableSizeLimit": "true" option.
So, my tsconfig.json file is:
{
"compilerOptions": {
"disableSizeLimit": "true"
},
"exclude": []
}
If none of suggested methods worked, try:
npm install -g typescript#latest
and then
Install the latest version of TypeScript for Visual Studio on Get TypeScript.

xUnit Test Runner failed to run tests through ReSharper

Visual Studio 2015 Enterprise Update 3, all KB package updates are applied
ReSharper 2016.1.2, latest
According to my project.json file xunit references are;
"xunit": "2.2.0-beta2-build3300",
"xunit.abstractions": "2.0.1-rc2",
"xunit.assert": "2.2.0-beta2-build3300",
"xunit.extensibility.core": "2.2.0-beta2-build3300",
"xunit.extensibility.execution": "2.2.0-beta2-build3300",
"xunit.runner.console": "2.2.0-beta2-build3300",
"xunit.runner.visualstudio": "2.2.0-beta2-build1149",
"xunit.runners": "2.0.0"
.Net framework is 4.5.2
.Net Core Solution type which means .xproj
When i try to use ReSharper xUnit test runner, i'm encountering;
"Unit Test Runner failed to run tests, Unable to run xUnit tests -
File not found:"D:\srcs\GitProjects..etc\bin\My.Tests.dll"
Parameter name: assemblyFileName
Sorry for Turkish exception details, i couldn't change yet.
Any idea about that? I searched a lot of forums and i couldn't find any useful stuff. Thanks in advance.
Support for .NET Core testing in Resharper is scheduled for 2016.3
The workaround is to use Visual Studio Test Explorer. (Test --> Windows --> Test Explorer)
The project.json file must contain xunit and dotnet-test-xunit:
{
...
"testRunner": "xunit",
"dependencies": {
...
"xunit": "2.2.0-beta2-build3300",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
},
...
}
Rebuild your project and you should be able to successfully run your tests.
If you have Visual Studio 2015 you can start your test inside the code.
Update: (2017-02-08)
It also works with nunit;
{
"testRunner": "nunit",
"dependencies": {
...
"NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3"
},
...
}
ReSharper doesn't currently support .net core testing. This is scheduled for 2016.3.
By installing the Early Access Program(2016.3) of Resharper, you will be able to run your dotnet core tests.
It supports both nunit and xunit.
I installed it, and it solved the issue for me.
Link to the relase details:
https://blog.jetbrains.com/dotnet/2016/09/26/resharper-ultimate-2016-3-eap-build-1-details/

Unit Testing Framework - An error occurred while parsing entityname

I have created simple MS Unit Test Project. Assert.Equal(true, true).
When I want to run a test I receive a error from Resharper and Visual Studio.
"Unit test Runner failed to run tests
System.Xml.XmlException: An Error occured while parsing EnityName. Line 1, position 17."
Do I missing something.
Edit:
I can't add screenshot and I can't select text to copy. Ok I will write it the best I can.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.xml.XmlTextReaderImpl.Throw(String res,String arg)
at System.Xml.XmlText.ParseEnityName()
at System.Xml.XmlTextReaderImplparseEnityReference
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextLoader.ParsePartialContent(XmlNode parentNode,String innerxmltext, xmlNodeType nt)
at System.Xml.XmlElement.set_InnerXml(string value)
at Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingHelper.AppendOrModifyChild(XpathNavigator,String nodePatH,String nodeNAME,sTRING INNERxML)
at Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.UpdatedRunConfiguration(XPathNavigator, ArchitectureeffectivePlatform,FrameworkVersion effectiveFramework,String resultsDirectory,String solutionDirectory,String binariesRootDirectory)
Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.MergeRunSettingsAndFindCompatibleSource()
at JetBrains.ReSharper.UnitTestProvider.MSTest11.MsTest11Runner.Run(IRemoteTaskServer server,String assemblyLocation,String runConfigurationFilename,IUnitTestRun run)
To solve this problem you don't need to reinstall Visual Studio or Resharper.
The problem was in a file path to my projects. This would explains why other Unit Test projects were fine because there were in a different location.
I guess this a bug inside Visual Studio Unit Testing Framework. If you have unit test project inside folders with special charts like '&' then Visual Studio will crash or Resharper will return this message.
I wonder where I can report this bug.
I have just run into this problem too and followed the advice above.
First my path had a folder named ...\m&e...
Then I copied the whole project folder to a new location without an '&' in the path.
After that everything was working well.

Experiencing "DEP3000" error when trying to run WinRT unit tests

I am experience this strange error trying to run unit tests for WinRT from Visual Studio 2012.
Error: DEP3000: Attempts to stop the application failed. This may
cause the deployment to fail. App Packages may only be shutdown as
part of a Visual Studio build operation
I don't understand at all what that could mean? I've tried restarting my computer and reinstalling developer license. How I reproduce it is I just create a new empty unit test project from the Visual Studio template. I don't touch the project at all. But, when I try to do Run Tests on it, it just says pending for a a while and then spits out that error
How do I fix this?
Specs: Windows 8 Enterprise 64bit, Visual Studio 2012 with Update 2
Also, I've seen this question about VS2012RC, but the answer doesn't seem to apply. I've tried every configuration of this there is and nothing works past this error
I had same problem when I applied VS upgrade2 AND used Resharper 7.1.1 to run the unittests. Turns out you need to upgrade Resharper to 7.1.3 -- or run the tests with the VS test explorer.
You can just try using XUnits App:
https://channel9.msdn.com/Shows/demooftheday/xunit-in-uwp
With this, test will run on XUnit's test app, not in VS Test Explorer.
In my unit test project's project.json
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
"xunit": "2.1.0",
"xunit.runner.devices": "2.1.0" }, "frameworks": {
"uap10.0": { } }, "runtimes": {
"win10-arm": { },
"win10-arm-aot": { },
"win10-x86": { },
"win10-x86-aot": { },
"win10-x64": { },
"win10-x64-aot": { } }
}
Then go to the XAML file in the unit test project named UnitTestapp.xaml and change it to
<ui:RunnerApplication
x:Class="UnitTestProject1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnitTestProject1"
xmlns:ui="using:Xunit.Runners.UI"
RequestedTheme="Light">
</ui:RunnerApplication>
And of course, in the code behind:
sealed partial class App : RunnerApplication
{
protected override void OnInitializeRunner()
{
AddTestAssembly(GetType().GetTypeInfo().Assembly);
InitializeRunner();
}
partial void InitializeRunner();
}