Usage of Fine Code Coverage in Visual Studio 2022 Community Edition - code-coverage

I've installed the extension Fine Code Coverage (Version 1.1.191) in Visual Studio 2022 Community Edition. I got a few xUnit test-projects in my solution. I'm getting the coverage statistics and the report by using the following settings:
run the tests from the visual studio Test Explorer (not the xunit testrunner)
Test => Options => Fine Code Coverage => RunMsCodeCoverage:
selection of "No" or "IfInRunSettings" produces the mentioned output
selection of "Yes" and not providing runsettings fails to produce any output and the Output window for FCC gives the message "No cobertura files for ms code coverage"
The README of the project states for the usage of MS Code Coverage with FCC:
Firstly you need to change the RunMsCodeCoverage option from No.
Ms code coverage requires a runsettings file that is configured appropriately for code coverage. This requires that you have the ms code coverage package and have pointed to it with the TestAdaptersPaths element as well as specifying the ms data collector.
...
FCC does not require you to do this. If you do not provide a runsettings and RunMsCodeCoverage is Yes then FCC will generate one. If RunMsCodeCoverage is IfInRunSettings then if the project has runsettings that includes the ms data collector element configured correctly then FCC will process the collected results.
As pointed out in my settings above I do not get a result if "RunMsCodeCoverage" is set to "Yes" without providing runsettings. On the other hand setting "IfInRunSettings" without providing runsettings I'm getting the desired output (are the runsettings generated automatically in this case?). So I find the description in the README in contrast to my results. Could it be that the documentation in this point is referring to the enterprise edition of VS? I'd like to be able to understand the different setup options/requirements so anyone who can shed a light on these is welcome.

Related

In Visual Studio can I run the Performance Profiler on a specific unit test?

I would like to see where I have bottle necks in a specific method. I believe that this is input dependent (a specific set of inputs will cause a much longer run time than others). I already have unit tests exploring the various input possibilities.
Is there a way for me in Visual studio to get the Debug > Performance Profiler to run on a specific unit test the same way I would debug a specific test (Test Explorer > Right Click > Debug)?
Visual Studio Professional 2019 Version 16.11.7

Open Cover filters how to avoid test assembly files from code coverage

I have gone through the Opencover wiki documentation and tried a lot to figure out what would be the filter criteria for not to include test assembly as part of code coverage. Here is the problem
for eg I have many assemblies starts with sample name like sample.submodule.assembly1.dll, sample.submodule.assembly2.dll, my tests assembly also starts with sample like sample.submodule.tests.dll, here I applied the filter criteria for openCover
1.-filter: "+[sample*]* -[*tests]*"
it didn't work, not generating report file.
-filter: "+[sample*]* -[sample.submodule.tests]*" didn't work, not generating report file,
-filter: "+[sample*]* -[*]*tests*" didn't work, not generating report file too,
can somebody please advise what can be the filter criteria here to exclude all the test files from code coverage
First run OpenCover without any filters.
Now you can look at the XML report produced (or you can use ReportGenerator to turn it into HTML) and identify assemblies/modules that you wish to exclude.
now you can apply filters using the filter switch e.g.
-filter:"+[*]* -[*.tests]* -[*.Tests]*"
NOTE: no space between : and first "
or
"-filter:+[*]* -[*.tests]* -[*.Tests]*"
if you are talking about writing unit test using visual studio nunit adaptor then you have open cover UI visual studio extension available for all such purpose. it is wonderful.
Step 1) Install open cover from latest relese build https://github.com/opencover/opencover/releases
Step 2) Usuall it will install C:\Users\goma1940\AppData\Local\Apps\OpenCover (%localappdata%\Apps\OpenCover)
Steo 3) Install VS Extn from gallery https://visualstudiogallery.msdn.microsoft.com/6950a046-8919-4935-8542-c6f37956f688
Step 4) you have open cover test explorer and open cover coverage result pane as below…

How to get code coverage in Xcode 6?

My tests are XCTests and I'm using Objective-C instead of Swift.
I've seen some articles that tackle the topic, but the seem focused on older versions of Xcode, for example:
Visualizing Code Coverage with Xcode
Code Coverage Fixed for Xcode 5.1
What would be the recommended approach to get code coverage on Xcode 6? Does Apple have something built in for code coverage, maybe via Xcode CI via OSX Server?
Take a look at frankencover.it
Simple script that can be run from dev's cmd-line or CI build server.
Produces console output as well as a detailed report in HTML format. This can be viewed locally or published as an artifact by the build server.
Optionally includes a checker that will 'fail' the build if required coverage is not met. (Feedback only. This is a prompt to review coverage and look for useful tests that can be added or reduce the required amount. Either option may be correct. )
Free for both commercial and open-source projects. No hosting, sponsorship or subscription required.
Usage:
FTW, it has an easy-to-remember dogue-speak-esque command line interface:
groovy http://appsquickly.github.io/frankencover.it/with --source-dir MyProject/Source
Terminal Output:
HTML Report:
We use Xcoverage for this..Check on link below, if this helps..
Xcoverage
This is an update, From Xcode 6 Apple having in-build code coverage tool, But Have a look at coverStory it is easy to configure test locally before push.
And providing a line by line coverage.

Generating code coverage report using theIntern

I am using theIntern for unit testing my javascript framework. My test is running fine using node.
However, I am not able to generate code coverage report properly. I tried the options provided in the documentation. I was successful to print code coverage information on to the console while testing through selenium web driver. That gives only a summary.
How can I generate extensive code coverage report using reporters other than console?
I provided the "reporters" option but doesn't print the report. Any help would be appreciated.
The lcov reporter generates an lcov.info file that can then be passed to the lcov genhtml utility to output a complete set of HTML coverage reports (the simplest invocation is just genhtml lcov.info).
In Intern 1.2, however, there is a bug with the generated lcov.info files (fixed for Intern 1.3) that may cause genhtml to fail to find any coverage data inside a generated lcov.info file. The patch for this issue is very simple and you should be able to cleanly it to Intern 1.2 until the new version is released in the next couple of weeks.

Having trouble building Z3 in Visual Studio

Hello I downloaded Z3 from http://z3.codeplex.com/ and then opened the Z3 solution in Visual Studio 2012. (While I'm not totally new to VS I haven't used it in over 10 years). There are 9 projects in this solution but I am having a hard time telling which I ought to be using. I can guess at some of them, but others aren't very clear. Eg. what is the difference between Microsoft.Z3 and Microsoft.Z3V3 ? Can anyone briefly explain what the different projects are and which ones to build?
Anyway just for kicks I tried building the top level solution but got the following errors
Error 1 error RC1015: cannot open include file 'afxres.h'. C:\Projects\z3-src-4.1.2\z3\dll\dll.rc 10 1 dll
Error 2 (same as Error 1 except in shell.rc)
Error 3 error LNK1104: cannot open file 'C:\Projects\z3-src-4.1.2\z3\Debug\z3_dbg.lib' C:\Projects\z3-src-4.1.2\z3\test_capi\LINK test_capi
Trying to build just the MS.Z3 project still gives me Error 1.
My eventual goal is to invoke Z3 from say an F# program. Can someone provide some guidance for how to do this?
Any help would be appreciated.
EDIT
This answer reflects the directory structure used in Z3 version <= 4.1.1. In version 4.3, the code base has been reorganized/simplified.
END EDIT
Which version of Visual Studio are you using? I'm asking because I want to reproduce the behavior you described.
The easiest way to build Z3 is described here.
You should use the Visual Studio Command Prompt, and execute msbuild. It seems you tried that, and got errors. Here is a short description of each project folder:
lib: the Z3 source code is here. This is the important folder. For visual studio users, it generated a static library.
dll: project for wrapping the static library as a Windows DLL. This is irrelevant for users in other platforms.
shell: uses the static library from lib to build z3.exe.
test: a bunch of unit tests. It produces test.exe.
Microsoft.Z3: .Net API. It is the official .Net API (C#, Visual Basic, F#, etc) for Z3. This is the API you should use with F#.
Microsoft.Z3V3: It is the old .NET API. It was the API available in Z3 3.x. We maintain it because some users still use it.
test_capi: Application that tests the Z3 C API.
maxsat: Small application that implements two maxsat algorithms on top of the Z3 API.

Resources