code-coverage

Can't analyze code coverage with Visual Studio 2019

余生长醉 提交于 2020-04-11 12:27:45
问题 I'm using Visual Studio 2019 to develop and test a .NET Core application. A few months ago, I remember that all my tests are successful and I was able to launch a code coverage analyze. Today I launched a code coverage analyze but it fails (tests are always successful): Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see https://go

How to check jest coverage in console?

半城伤御伤魂 提交于 2020-03-21 06:54:38
问题 I have some jest tests and I can determine the coverage with jest --coverage Also see Code coverage for Jest I automatically execute the tests on a build server (gitlab runner) and want that my tests fail if the coverage is below a certain limit . In python there is a flag --cov-fail-under that can be used with pytest, e.g. pytest --cov src --cov-fail-under=90 --cov-report=term Unfortunately, I could not find a corresponding option for jest. =>What is the recommended way to check the total

Show the differences in two test-coverage runs

北慕城南 提交于 2020-02-08 10:14:31
问题 I'm in the process of writing tests for some old and disowned code. I've found coverage.py to be a useful tool in helping me decide which test to write next. As I improve our testing I'd like to see how I've affected our coverage. Currently I'm doing this by bringing up the html report twice, in side-by-side browser windows, and visually looking for differences. This seems very crude. Do any of you have a better solution? I found z3c.coverage, and after struggling to get zope-testrunner

How to force a curl request in a PHP method to fail for a unit test

吃可爱长大的小学妹 提交于 2020-02-06 23:59:13
问题 I'm covering some legacy code with unit tests. I have some code that looks like this † (I have removed the bits not relevant to this question): public function search($query) { $query = urlencode($query); $url = 'https://example.com/search.php?q=' . $query; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url, )); $data = curl_exec($curl); if (!$data) { throw new Exception('An error occurred while trying to process the request.'); } } How can I

How to get code coverage report in donetcore 2 application

安稳与你 提交于 2020-02-06 11:11:13
问题 I am new to dotnet core 2.0, not sure how to extract code coverage report with dotnet test command. Looking for help from the community. 回答1: OpenCover is an open source code coverage tool for dotnet core. You can use it in conjunction with ReportGenerator to get coverage reports. https://github.com/OpenCover/opencover https://github.com/danielpalme/ReportGenerator 回答2: Here is my .bat file to generate dotnet core. This will "pop" an index.htm file. This is just a .bat file version of what I

Django nose to run only project tests

岁酱吖の 提交于 2020-02-04 01:16:12
问题 I added nose , django-nose , nose-exclude , coverage to my buildout.cfg and ran buildout. Furthermore I added the TEST_RUNNER and the NOSE_ARGS to my settings.py. In the last step I created a exclude_dirs.txt and included it into the NOSE_ARGS . That worked so far. Finally I ran bin/django test to run the tests of my project. I found out that every app inside INSTALLED_APP is run and that even parts of the django core models are run. How can I limit this to my project only without exernal

nyc (istanbul) exclude test code from coverage reports

陌路散爱 提交于 2020-02-03 10:10:50
问题 I'm trying to add coverage report generation to a typescript library project. The layout includes these directories: project ├─ src │ ├─ lib ## project code (typescript), *.tsx │ ├─ test ## test specs (typescript), *.spec.tsx │ └─ @types ## types I made for a few dependencies that didn't have them └─ build ├─ lib ## compiled project code (ES5 + type info, with inline sourcemaps), *.js and *.d.ts └─ test ## compiled test specs (ES5 + type info, with inline sourcemaps), *.spec.js and *.spec.d

Minimal code to use Istanbul programmatically

我的梦境 提交于 2020-01-22 20:16:11
问题 I want to execute the command istanbul cover node_modules/mocha/bin/_mocha dist/test using the Istanbul programmatic API. But the docs don't say much about it, besides that everything is possible and linking to the enormous API documentation. I couldn't find any short example on the internet. I do not want to spawn a child process or use another module from NPM. I know how to run Mocha programmatically without coverage, so that is not the problem. 回答1: I figured out one way to do this, but it

Running NUnit tests in Visual Studio 2010 with code coverage

不打扰是莪最后的温柔 提交于 2020-01-22 05:34:34
问题 We have recently upgraded from Visual Studio 2008 to Visual Studio 2010. As part of our code base, we have a very large set of NUnit tests. We would like to be able to run these unit tests within Visual Studio, but with code coverage enabled . We have ReSharper, so can run the tests within Visual Studio, but it does not allow the code coverage tool to do its thing and generate the coverage statistics. Is there any way to make this work, or will we have to convert the tests over to MSTest?

How to ignore generated files from Go test coverage

大憨熊 提交于 2020-01-21 02:42:48
问题 I have a generated file in my package with DO NOT EDIT on top. I am running tests for my package with go test -coverprofile=cover.out <package> . This creates coverage profile and shows total coverage percentage. But it also includes generated files while calculating the coverage. Is there a way to ignore generated files in coverage calculation? 回答1: Most Go tools operate on packages, because a package itself forms a unit that may be useful in its entirety. Excluding files from a package