New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does it make any difference if the projects being tested/covered are built in DEBUG or RELEASE mode? #659
Comments
Yep the configuration changes the results because compiler could emit different IL so you can run you CI with both configuration(I advice to do that for testing reason) but you could see slightly different coverage result, check this old issue for instance #389 |
For testing perspective it's very different usually related to performance always from emitting side and also because usually in debug/checked mode you run assertion and preprocessor use Semantics must remain the same. |
Thanks heaps @MarcoRossignoli for the prompt reply 👍 I sorta don't understand what you are saying though 😊 Yes -> DEBUG creates different IL compared to RELEASE. Okay, that make sense .. but what should I be using for code coverage? I had a read over #389 and it was a bit .. technical for me 😊 So even though there's different IL, should we be testing our projects that are compiled under DEBUG configuration for code coverage because there's less optimizations, etc? |
DO testing DEBUG/RELEASE and check coverage report under DEBUG, btw if you've a simmetric CI where you simply pass $(configuration) as parameter won't be a problem you'll test/cover both config and it's ok. Debug report of coverage are usually more "precise" related to covered line because IL/pdb emitted by compiler is more "detailed". |
For instance check coverlet CI https://github.com/tonerdo/coverlet/blob/master/eng/build.yml we build test and cover in both configuration...I'll check only debug one. |
I mean usually debug it's enough, but suppose to have a bug where some code run only in debug mode and with that coverage percentage reach 90% but you'll find that in release mode drops under 80%...likely it's something to double check. |
Oh wow! that's ... really interesting. CI/CD Summary
But how is is the code coverage kicked off? yml task:
build log:
which suggests it's the MSBuild way? Where is the msbuild stuff defined/set? I also thought that the preferred way is to do this via the |
Yes we use msbuild at the moment because we know that it doesn't affected by know issue, so you should use collectors if possible. |
For us it's also a way to test engine, we use code just build and we inject it through msbuild targets, but it's only for internal use. |
Okay, so if I use the |
Yep, you can follow our hello world sample https://github.com/tonerdo/coverlet/tree/master/Documentation/Examples/VSTest/HelloWorld with and without runsettings the internal engine it's the same, so also the options we call msbuild/vstest/.net tools drivers that run same engine, the only difference is that some "config options" could be not "exposed" for some drivers, but we can add i needed. |
Hi again @MarcoRossignoli - I'm back here trying to get this working once more. TL;DR;I'm not getting any summary of results, listed to the terminal. Info:So i'm trying to learn off your repo azure-pipelines.yml file. In it you have various OS flavours and are doing both DEBUG and RELEASE builds. Great. In all of the TEST step, it produces a nice graphical result to the logging console out.
I'm not getting this report into my logs. I'm using the "collector" solution (not msbuild, not global tool). Is that why? e.g.
and each xunit test project includes the nuget package...
When I look at the logs in AzureDevOps, I can see this at the top ...
so it looks for all the tests in the
So it looks like:
but noticed how it says: Attachments .. is that causing this to not print? This repo ReadMe.md says:
which is not occurring :( I also tried using change the format to opencover, but that errored all the time => wrong or bad switch. e.g. |
Simply printing results to console is not supported for collectors for the moment. Collectors are a totally different beast than .net tool and msbuild, we don't have complete control of workflow but we're injected inside the vstest engine. Opened a issue #681 |
Kewl thanks - much appreciated. Q1: So even though there's no output to the terminal (reported separately in #681) it still creates the coverage xml file ... which means we could still use a 3rd party tool to help interegate the coverage results (e.g. codecov.io or ReportGenerator), right? Q2: Secondly, in your azure pipelines for this repo, you so DEBUG and RELEASE. How do you only get coverage for DEBUG tests? It feels like each OS generates coverage for DEBUG and RELEASE mode? The scenario is that I wish to generate coverage for DEBUG only (as suggested by you, above) and then use a 3rd party to interigate the results. Q3: Lastly, how do you specify the |
Yes
If you want keep coverage for release but they are different because different IL is emitted by compiler.
You need to provide a I apologize for late answer I lost this last comment and I don't know why 🙇 |
No probs at all. Since I got some answers and clues to this issue, a few months ago, I've started doing coverlet coverage for
to do this, i'm using a powershell script which does one or the other, based on the 'configuration' (D or R). works great :) cheers 👍 |
Glad to hear!feel free to ask if you're in trouble! |
Does it matter if the projects which are getting tested against, if they are built using DEBUG or RELEASE configuration?
I know the test project isn't covered so I don't care what that is built against ... but the test project tests OTHER netstandard libraries / netcore apps ... which I'm wondering if I do care about the 'configuration' setting for those.
The text was updated successfully, but these errors were encountered: