altcover

InvokeAltCoverCommand class

The equivalent of the AltCover command or altcover global tool.

The arguments parallel the command-line executable; the main difference is that -Runner is a switch parameter that selects the runner-mode parameter set if present.

The “working directory” used where mentioned in the parameter descriptions is the current set location in PowerShell, not the underlying current directory.

Note: As Powershell informational output is suppressed by default in PowerShell 5+, the -InformationAction Continue option is needed to show the progress and summary information for the process if this is desired.

Summary information is also written to the object pipeline.

Note: -WhatIf includes validation for the command line arguments. It is ignored for the purely read-only -Version option

Invoke-AltCover -Report $x -OutputDirectory  $o -InputDirectory $i -AssemblyFilter "Adapter" -ReportFormat NCover -InformationAction Continue
public class InvokeAltCoverCommand : PSCmdlet

Public Members

name description
InvokeAltCoverCommand() The default constructor.
AssemblyExcludeFilter { get; set; } Assembly names to exclude from instrumentation (linked to instrumented assemblies)
AssemblyFilter { get; set; } Assembly names to exclude from instrumentation (linked by instrumented assemblies)
AttributeFilter { get; set; } Attribute names to exclude from instrumentation
AttributeTopLevel { get; set; } Attributes to mark a type as “top level”
BranchCover { get; set; } Do not record line coverage. Is not compatible with the -ReportFormat “ncover” option. Incompatible with -LineCover.
CallContext { get; set; } Tracking either times of visits in ticks or designated method calls leading to the visits.
Cobertura { get; set; } File path for Cobertura format version of the collected data
CommandLine { get; set; } Arguments for a launched process
Defer { get; set; } Defers writing runner-mode coverage data until process exit.
Dependency { get; set; } Assembly paths to resolve missing references.
DropReturnCode { get; set; } Do not report any non-zero return code from a launched process.
Executable { get; set; } The executable to run e.g. dotnet
FileFilter { get; set; } Source file names to exclude from instrumentation
InPlace { get; set; } Instrument the inputDirectory, rather than the outputDirectory (e.g. for dotnet test)
InputDirectory { get; set; } Folder or folders containing assemblies to instrument (default: current directory)
Key { get; set; } Strong name key or keys that were used to sign the inputs
LcovReport { get; set; } File path for lcov format version of the collected data
LineCover { get; set; } Do not record branch coverage. Is not compatible with the -ReportFormat “ncover” option. Incompatible with -BranchCover.
LocalSource { get; set; } Don’t instrument code for which the source file is not present.
MethodFilter { get; set; } Method names to exclude from instrumentation
MethodPoint { get; set; } Record only whether a method has been visited or not. Overrides the -LineCover and -BranchCover options.
MethodTopLevel { get; set; } Names to mark a function as “top level”
OutputDirectory { get; set; } Folder or folders to receive the instrumented assemblies and their companions (default: sub-folder __Instrumented of the current directory; or __Saved if -Inplace is set).
OutputFile { get; set; } Write the recorded coverage to this file rather than overwriting the original report file.
PathFilter { get; set; } Source file paths to exclude from instrumentation
Portable { get; set; } Portable operation - coverage report, control file and recorded data co-located with the recorder assembly
RecorderDirectory { get; set; } The folder containing the instrumented code to monitor (including the AltCover.Recorder.g.dll generated by previous a use of the .net core AltCover).
Report { get; set; } The output report template file (default: ‘coverage.xml’ or ‘coverage.json’ in the current directory)
ReportFormat { get; set; } Generate the report in the specified format (NCover, JSON or the default OpenCover)
Runner { get; set; } Selects Runner mode
Save { get; set; } Write raw coverage data to file for later processing
ShowGenerated { get; set; } Mark generated code with a visit count of -2 (Automatic) for the Visualizer if unvisited
ShowStatic { get; set; } Instrument and show code that is by default skipped as trivial.
Single { get; set; } only record the first hit at any location (or first for that context if -CallContext is operating).
SourceLink { get; set; } Display sourcelink URLs rather than file paths if present.
StrongNameKey { get; set; } The default strong naming key to apply to instrumented assemblies
SummaryFormat { get; set; } Selects summary format
SymbolDirectory { get; set; } Additional folder or folders to search for matching symbols for the assemblies in the input directory
Threshold { get; set; } One or more of minimum acceptable statement (S), branch (B) or method (M)/alternative method (AM) coverage percentage (integer, 1 to 100) or maximum acceptable CRAP/alternative CRAP score (C/AC followed by integer, 1 to 255) e.g. M80AM70C40AC100B50. If the value starts with a number, a leading S is assumed. If any threshold is specified more than once, the last instance is assumed – so 25S50 counts as S50. Zero/absent values are ignored. If a coverage result is below threshold, or the CRAP score is above threshold, the return code of the process is the largest abs(threshold - actual) rounded up to the nearest integer.
Trivia { get; set; } Omit trivial sequence points
TypeFilter { get; set; } Type names to exclude from instrumentation
TypeTopLevel { get; set; } Names to mark a type as “top level”
Verbosity { get; set; } Selects output level of the command. Each level writes to the matching PowerShell Write-[Level] channel
Version { get; set; } Selects Version mode
VisibleBranches { get; set; } Hide complex internal IL branching implementation details in switch/match constructs, and just show what the source level logic implies.
WorkingDirectory { get; set; } The working directory for the application launch
ZipFile { get; set; } Emit the XML report inside a zip archive.
override ProcessRecord() Perform the AltCover operation

See Also