Comments (5)
I'm not sure what it is you are actually doing, as dotnet build [solution]
takes no notice of the altcover properties; there is no __Instrumented
folder after such an operation.
I suspect that what you want to do is use altcover
as a command-line tool, as discussed in e.g. the modes of operation wiki page. For this style of operation you can give the path to the altcover binaries in the nuget cache, but it is probably more convenient to either explicitly nuget it to a local folder; or better, use the altcover global tool.
from altcover.
With a simple solution like this one
doing
dotnet test TestProject1.sln --configuration Release --property:AltCover=true --property:AltCoverReportFormat=opencover
gives an error trying to test the console application
but going to the instrumented folder and running the console application gives
and the coverage.xml
file in the console app project directory contains the obvious visit
<Class>
<Summary numSequencePoints="1" visitedSequencePoints="0" numBranchPoints="1" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="1" minCyclomaticComplexity="1" visitedClasses="0" numClasses="1" visitedMethods="0" numMethods="1" minCrapScore="2" maxCrapScore="2" />
<FullName><StartupCode$ConsoleApp1>.$Program</FullName>
<Methods>
<Method visited="false" cyclomaticComplexity="1" nPathComplexity="0" sequenceCoverage="0" branchCoverage="0" isConstructor="false" isStatic="true" isGetter="false" isSetter="false" crapScore="2">
<Summary numSequencePoints="1" visitedSequencePoints="0" numBranchPoints="1" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="1" minCyclomaticComplexity="1" visitedClasses="0" numClasses="0" visitedMethods="0" numMethods="1" minCrapScore="2" maxCrapScore="2" />
<MetadataToken>100663298</MetadataToken>
<Name>System.Void <StartupCode$ConsoleApp1>.$Program::main@()</Name>
<FileRef uid="36" />
<SequencePoints>
<SequencePoint vc="1" uspid="0" ordinal="0" offset="0" sl="2" sc="1" el="2" ec="24" bec="0" bev="0" fileid="36" />
</SequencePoints>
<BranchPoints />
<MethodPoint xsi:type="SequencePoint" vc="0" uspid="0" ordinal="0" offset="0" sl="2" sc="1" el="2" ec="24" bec="0" bev="0" fileid="36" />
</Method>
</Methods>
</Class>
being the results of a run in "classic" mode (just the visit counts filled in, not the summaries); with no filtering, report file also includes the FSharp.Core
assembly.
So I'm not sure exactly what it is you were doing; but knowing that it would have to be more than what was specified above, which doesn't even ask for the coverage file to be zipped.
The fix issue #209 will mean that the console program will not be tested, or even instrumented stand-alone; however by going to the instrumented folder under the test program, it is possible to run the instrumented console app, with the results, in this case, going in classic mode to the test project's coverage file.
from altcover.
So I'm not sure exactly what it is you were doing;
What I was doing was:
- Adding altcover package to all projects
- Building in Debug mode (this creates the
__Instrumented
folder) - Trying to run the executables from the
__Instrumented
folder.
Now, after further research about the Modes of Operation, I realize:
- I don't have to add altcover package, but instead can use altcover global tool.
- Build in Release mode
- Instrument the binaries into a separate folder before running them using global tool.
I think it might have helped me a bit if the Modes of Operation wiki page was clearer to understand somehow but I'm not sure how. But it could also help if there was simple examples of how to use altcover
in GitHub Actions or in CI environment.
I've gotten it all running now. Thank you for your help and for your work on this great project!
Please feel free to close this issue if you see that I what I was doing initially is not a supported mode/method of running altcover.
from altcover.
Thanks for the comments on the documentation. It's partly a result of the original AltCover (2010-2017) having been a plain .Net Framework application; with the dotnet test
integration being a later extension which tries to join in the automatic behaviour of the newer tool, which has in the subsequent years become the default way of doing things rather than something new and exotic.
This is the part that I'm not sure about, and would like to understand before I close the issue
Building in Debug mode (this creates the __Instrumented folder)
because just building shouldn't create that folder.
That requires running the VSTest
target, within which the Prepare
task that creates that directory is executed, and dotnet build
doesn't go near the testing target.
Secondly, to be looking for a zipped coverage file, it would need $(AltCoverZipFile)
to have been set to "true"
, which isn't the sort of thing that happens by accident.
from altcover.
This is the part that I'm not sure about, and would like to understand before I close the issue
Building in Debug mode (this creates the __Instrumented folder)
I tried to reproduce it but was not able to. I must have been mistaken how that folder was created. Sorry.
from altcover.
Related Issues (20)
- Microsoft.NET.Test.Sdk 17.8.0 support HOT 7
- [enhancement] integration with xharness and/or device runners for iOS and Android HOT 2
- `dotnet test /p:AltCover=true /p:AltCoverInPlace=true` results in System.IO.IOException: The process cannot access the file 'C:\src\testprj\bin\Debug\net8.0\AltCover.Recorder.g.dll' because it is being used by another process. HOT 5
- help with getting started HOT 2
- Path.GetFullPath no longer resolves long file paths HOT 7
- Adding AltCover to projects results in dotnet test running against all projects in solution HOT 6
- Running AltCover Runner in parallel mode HOT 2
- Question about cyclomatic complexity for pattern match HOT 2
- Changes so AltCover will run when FIPS compliance is required HOT 13
- .../Temp/tmp###.altcover.runsettings not found Intermittent tests ignored. HOT 2
- BranchPoints differ between .NET Framework and .NET 7 when using interpolated strings HOT 5
- Question Regarding assemblies being added to code coverage result HOT 2
- Command vstest.console.exe not started. Why? HOT 3
- altcover runner --OutputFile gives incorrect summary output HOT 8
- ERROR *** Instrumentation phase failed - Failed to resolve assembly: System.Data.Common HOT 8
- Generic methods share the same name and signature HOT 5
- Collection phase failed with an Error HOT 9
- Per-test level code coverage HOT 2
- Coverage collection requires instrumented code in same location until collection is not completed causing service downtime HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from altcover.