On my M1 mac, using Xcode 13.3, I created a package and displayed the code coverage bar (Editor menu –> Code Coverage).
After running tests, there is no indication of code coverage at all in the source code.
How do I get code coverage when testing a package?
The problem is that you didn't turn on Code Coverage for the library's scheme. Turn it on:
See the checkbox at the bottom: Code Coverage? Check that checkbox.
Now run the package test and coverage will be gathered. The best way to see it, in my experience, is actually in the report navigator:
Related
As of last month, I am now facing an issue in VS Code where the go tests in my Go project do not show up in Test Explorer.
NOTE - I am able to run the tests directly from Codelens in the file, but as far as the Test explorer UI is concerned it cannot configure my tests.
This was previosly working in VS Code quite well with out any issues.
The Output from the Go module indicates the following error the first time I try opening the Test Explorer.
Failed to resolve tests: TypeError: Cannot read property 'groups' of null
Test Explorer view showing that tests are not found in workspace
I know about new feature in Xcode 7 - Code Coverage. I know how to turn it on:
go to Edit scheme -> Test -> Info tab -> enable Gather coverage data.
I did it, run tests, and... Where is Test Report for my tests?
Since you turned it on in your scheme, and then build and test:
Go to your Report navigator
Then select your last test:
Finally choose Coverage tab:
Remember also to enabled test coverage in your bot settings, there is new picker in Xcode 7 (Disabled by default)
Is there a way to run all test in an root pom and collect test coverage in Intellij Idea ?
Create a Run Configuration that will look for tests in the whole project. Make sure that you choose All in package and In whole project in the configurations dialog:
Make sure that you choose the <default> package in the Choose Package dialog.
Now you can select to run this configuration using Run 'All in project' with Coverage:
The result will be presented in a separate coverate window:
And you will also see the result in the Project View window for a fast overview:
Right click on the parent module (root pom), and select Run 'All Tests' with Coverage.
There is a 'Coverage' plugin, which may not be enabled by default.
Find it at File->Settings->Plugins.
This will enable the 'Run with Coverage' buttons and menu items.
A short official overview video is here: Code Coverage by IntelliJ IDEA
I am having some issues with getting Code Coverage working with an out-of-the-box ASP.NET MVC2 Web App
VS2010 Ultimate, File > New Project > ASP.NET MVC 2 Web Application > Yes, Create unit test project with Visual Studio Unit Test. I then Rebuild All, Run All Unit Tests, Go to Code Coverage and get the following message:
Cannot find any coverage data (.coverage or .coveragexml) files. Check test run details for possible errors.
All the unit tests passed. (And I haven't touched a line of code yet)
I did find the following on the web:
http://www.vbforums.com/showthread.php?t=615377
which says to do the following:
Test -> Edit Test Settings -> Local
In the test settings dialog, click
"Data and Diagnostics" Ensure "Code
Coverage" are checked, and
double-click on it Check of the dll's
you want code coverage enabled for.
But, when I go to Test > Edit Test Seetings, all I see is the grayed out menu item stating "No Test Settings Available".
Any ideas?
Edit: slowly gaining traction. See: How to create the vsmdi/testrunconfig file when importing a Visual Studio test project?
I have had this same problem occur when I added a test project from another source (ie added to, but not created in the current solution). When doing this, local.testsettings, Solution.vsmdi, and TraceAndTestImpact.testsettings are NOT created inside your solution.
This fix is really quite simple, though. Simply right click on your solution and click Add -> New item. A new window will appear. On the left-hand side under General and Performance should be Test Settings. This should let you add a .testsettings file that you can now edit.
More information can be found here:
http://msdn.microsoft.com/en-us/library/ee256991%28v=vs.100%29.aspx
I'm trying to set up unit testing with code coverage in VS2008, for a C++/CLI DLL which is compiled with /clr (not /clr:safe or /clr:pure - it has to be /clr because it uses MFC).
The unit tests work perfectly but the coverage information only works if I compile with /clr:safe or /clr:pure. For /clr the Code Coverage Results window shows the following message:
Empty results generated: none of the
instrumented binary was used. Look at
test run details for any
instrumentation problems.
I've also tried "going offroad" but when I load the coverage file into VS, it also contains empty results.
Annoyingly I can't find anywhere that specifically says whether Code Coverage works with /CLR, so I just had to try it myself.
If it should work, can anyone see what I'm doing wrong here?
[File]->[New]->[Project]
Select Class Library, enter MyProj as the project name, click OK
Right-click on MyProj project, select [Properties]
Select [Configuration Properties]->[General]
Ensure "Common Language Runtime support" is set to /CLR
Add this code to Class1:
public:
static int calc() { return 69; }
Build solution
[Test]->[New Test]->[Unit Test], click OK, click Create
Add this code to TestMethod1:
Assert::AreEqual(MyProj::Class1::calc(), 69);
Right-click on TestProject1 project, select [References]
Click "Add New Reference"
Select MyProj in the "Projects" tab, click OK, click OK again
[Test]->[Edit Test Run Configuration]->[Local Test Run]
Select [Code Coverage]
Check MyProj.dll, click Apply, click Close
[Test]->[Run]->[All Tests in Solution]
The Test Results window shows TestMethod1 has passed.
The Code Coverage Results window shows the following message:
Empty results generated: none of the
instrumented binary was used. Look at
test run details for any
instrumentation problems.
Right-click on MyProj project, select [Properties]
Select [Configuration Properties]->[General]
Change "Common Language Runtime support" to /CLR:SAFE or /CLR:PURE, click OK
Build solution
[Test]->[Run]->[All Tests In Solution]
The Test Results window shows TestMethod1 has passed.
The Code Coverage Results window now shows correct coverage information.
Based on http://msdn.microsoft.com/en-us/library/ms182534.aspx
1-project must be in debug
2.-in the project properties you must select x 86 platform.
3 Unregister the project being tested in the GAC.
Yeh, I think it all has to be in CLR:Safe project to work. I don't fully understand why, but I'm in the same boat as you.