I was trying to visualize unit test code coverage report in WebStorm. I run Jest tests and generate coverage reports, (as you can see on the screenshot from WebStorm IDE bellow) but somehow only for one of the libs this reports is visualised and I can't understand why we can see this only for 'core' and not for 'components' or 'themes' libs.
Question is how to enable visualization of jest coverage report inside WebStorm IDE ?
PS I am using NX Monorepo setup if this maybe the issue.
PS Here some progress on the issue apperantly in order to see the coverage report inside the Webstorm it has to be present in "Show Coverage Data" window (check the screenshot bellow). Now the problem is that Webstorm allows for you to manually add a directory with coverage report but after you do this nothing happens. ONLY if you run your test via the "Run with Coverage" button in the IDE the generated report is recognized by Webstorm and automatically added to "Show Coverage Data" window, this looks like a bug in Webstorm IDE can someone confirm this behaviour.
Thank you for your prompt. I already know the reason.
You told me about the "Run with Coverage" feature, and I used it to find a solution to the problem.
It actually calls --verbose as an argument.
So, you just type the command: jest --verbose --coverage into the terminal and you get a detailed report. Then you can use "Show Coverage Data" to open the coverage folder under the project folder, open lcov.info, and browse the test coverage for the entire project.
Related
I have a node.js project running mocha tests, and I'm generating a coverage report using blanket. I've managed to get the coverage report generated, but I'm not sure how to generate a report that can be consumed by and viewed in Jenkins. Any suggestions? I'm looking for a result similar to the Cobertura plugin (https://wiki.jenkins-ci.org/display/JENKINS/Cobertura+Plugin).
Edit: Sorry i misread your question, if the coverage report gets published with the xunit report i dont know. So the following might not help you.
The XUnit reporter should create a report that can be parsed by jenkins.
Check out this blog post.
Also, have a look into the XUnit Plugin, it allows to specify the parser for various kinds of report formats.
Quote for persistence:
Source https://blog.dylants.com/2013/06/21/jenkins-and-node/
Let me start by saying I'm new to both ReSharper and dotCover and that I'm using v10.0.2 of both.
The attached screenshot shows solution explorer in VS and the coverage tree for a set of tests.
Whenever I run coverage, it always shows the same subset of assemblies in the coverage tree. Importantly, all of the tests shown are for code in either the Services or Infrastructure assemblies, neither of which show in the coverage tree.
Clearly, the product is not doing something right or I'm not.
Why are only some of the assemblies shown in the coverage tree?
Why aren't any of the assemblies covered by the tests I'm running
shown in the coverage tree?
How do I make it work properly?
EDIT
If it makes any difference, I'm using xUnit and have the xUnit running extension installed in ReSharper and the tests themselves run just fine.
This is due to shadow copying - when enabled, dotCover expects .pdb files to be copied too, and the standard shadow copy that xunit performs doesn't do this. If you disable shadow copy in the Unit Testing options page, it'll work fine. I think the xunit runner can be updated to fix this.
The YouTrack issue that describes what's going on is here: DCVR-7976
In my case the *.pdb files where deleted by a post-build event. After changing that, coverage-analysis worked again.
This post from the support forum of jetbrains helped me
I have a setup basically described here - http://karma-runner.github.io/0.8/plus/RequireJS.html
Problem is that I can't see source files of my tests in Chrome dev tools. So I can't debug it. Adding debugger; works but it is very uncomfortable, almost unusable since I can't browse any other file except the one with debugger; currently fired
Seems like karma load files, parse them, wrap each test and then unload files before run.
ng-boilerplate has a grunt build that will put all your plain js files into a build directory for testing and debugging.
Take a look at the Gruntfile and karma/karma-unit.tpl.js for how this is done.
Running grunt watch will leave your browser in a state where you can debug all your tests. Just click the debug button, set your break point(s) and reload the page.
Suddenly, you are debugging any or all your js files.
If you need to debug your test deeply, this is generally an indicator of badly organized code or badly made unit test. If you follow a TDD workflow, taking small step will help you prevent any major issue with your code. I warmly recommend you watch this video: http://blog.testdouble.com/posts/2013-10-03-javascript-testing-tactics.html?utm_source=javascriptweekly&utm_medium=email (it doesn't use Karma, but you should watch it for the workflow/the principles presented)
Then, if you really want to debug your test code, nothing beat the browser. As so, you should set up your test in a manner it can be runned both in Karma and the browser. We implemented this for QUnit, Jasmine and Mocha on the Backbone-Boilerplate. Feel free to base yourself on these settings to set up your own environment.
I have solution with a WPF application, its class libraries, WiX installer and numerous MSTest test projects.
When I build the solution the test runner (we are using Visual Studio 2012.3) correctly discovers all the tests and allows us to run them.
Now I have created a Coded UI test project with just 1 CUIT test in it. I have added the project to the solution; because it is a complete app test of the thing the solution builds this seems logically correct to me.
However the default behaviour is the new test projects CUIT test is being discovered by the test runner and so gets run when I run all tests. I do not want this I only want the other (unit) tests to be found and run this way.
Is there a way (test class attributes perhaps) to supress the DISCOVERY of the test by the test runner?
(Note this is a similar question to Testing an WPF app with CodedUI tests, should the coded ui test project share a solution or not? but asking the specific question that is;
If a solution contains some test how can I prevent those tests being discovered by the test runner?
Any solution should still allow the "undiscovered" test to be selected in a lab build for automation of MTM tests.
I simply unload the project until I want to run the tests.
Which projects are unloaded are saved in the .suo file, which can be excluded from source control if your lab build is being done automatically, or you can reload in manually if your lab building is created manually.
In the options menu of ReSharper, under Tools > Unit Testing > MSTest, you can enable MSTest, and then there is a checkbox "Run tests even if Code Coverage is enabled".
Wat is the impact of enabling this option?
It was initally off, but as Code Coverage is enabled on our project, I had to check this option for ReSharper to run the unit tests. But why would ReSharper, by default, not want to run MSTest unit tests when Code Coverage is enabled?
Apparently, ReSharper test runner must have had problems with MSTest when Code Coverage is enabled. I haven't explored this in full detail, because, as gorhoroh mentioned in the comment on my question, the option is no longer there.
If anyone cares to elaborate on this further, I'll be happy to mark that as an answer, provided it really explains what the implications were of course.