SteveGilham / altcover

Cross-platform coverage gathering and processing tool set for dotnet/.Net Framework and Mono
MIT License
494 stars 17 forks source link

Command vstest.console.exe not started. Why? #218

Closed maurosoft1973 closed 2 months ago

maurosoft1973 commented 2 months ago

AltCover version 8.8.21

  1. The first command just did the instrumentation and wrote a couple of template files (for the raw output)

    altcover --inputDirectory=/source/test/bin/Debug/ --outputDirectory=/source/test/bin/Debug/AltCover/ -s=Microsoft.* -s=xunit.* -s=Testcontainers.* -s=Bogus.* -s=Docker.* -s=ICSharpCode.* -s=System.* -s=Spekt.* --report=/source/test/bin/Debug/reportDir/rawReport.xml --reportFormat=OpenCover --save
  2. The second command actually run the tests and caught the raw output, and then wrote the final output report based on the raw files.

    altcover Runner --recorderDirectory=/source/test/bin/Debug/AltCover --outputFile=/source/test/bin/Debug/reportDir/finalReport.xml --executable=/usr/bin/vstest.console.exe -- /source/test/bin/Debug/AltCover/MyTest.dll

    This is the result of command 2:

    Beginning run...
    Command line : '/usr/bin/vstest.console.exe /source/test/bin/Debug/AltCover/MyTest.dll'
    Getting results...
    A total of 0 visits recorded
    Coverage statistics flushing took 0.63 seconds
    Visited Classes 0 of 142 (0)
    Visited Methods 0 of 440 (0)
    Visited Points 0 of 3613 (0)
    Visited Branches 0 of 1417 (0)
    Maximum CRAP score 0
    ==== Alternative Results (includes all methods including those without corresponding source) ====
    Alternative Visited Classes 0 of 152 (0)
    Alternative Visited Methods 0 of 543 (0)
    Alternative maximum CRAP score 0

    Why is the command /usr/bin/vstest.console.exe /source/test/bin/Debug/AltCover/MyTest.dll not called up?

Where do I go wrong?

Execution takes place in a mono container

I thank those who will give me an answer to the problem.

SteveGilham commented 2 months ago

The absolute silence between the Command line : ... and Getting results in your case - not even an error message being echoed - is unexpected.

The AltCover build under Linux on GitHub runs unit tests under mono, admittedly with NUnit rather than VStest, but in a very similar manner

/usr/bin/mono --debug /home/runner/work/altcover/altcover/_Binaries/AltCover/Release+AnyCPU/net472/AltCover.exe -o ./__VisualizerTestWithAltCoverRunner -s "\.DataCollector" -s Sample -s Microsoft -s testhost -t "System\." -t "Sample3\.Class2" -t Microsoft -t ICSharpCode -t <Start -t UnitTestStub -t SolutionRoot -m WaitForExitCustom --sn /home/runner/work/altcover/altcover/Build/SelfTest.snk --reportFormat OpenCover -r /home/runner/work/altcover/altcover/_Reports/VisualizerTestWithAltCoverRunner.xml --single --localSource

then

/usr/bin/mono --debug /home/runner/work/altcover/altcover/_Binaries/AltCover/Release+AnyCPU/net472/AltCover.exe Runner -r /home/runner/work/altcover/altcover/_Binaries/AltCover.Visualizer.Tests/Debug+AnyCPU/net472/./__VisualizerTestWithAltCoverRunner -x /home/runner/work/altcover/altcover/packages/nunit.consolerunner/3.12.0/tools/nunit3-console.exe -- --noheader --work=. --result=./_Reports/VisualizerTestWithAltCoverRunnerReport.xml /home/runner/work/altcover/altcover/_Binaries/AltCover.Visualizer.Tests/Debug+AnyCPU/net472/__VisualizerTestWithAltCoverRunner/AltCover.Tests.Visualizer.dll

but after echoing the command line, that shows the console output from NUnit like

Beginning run...
Command line : '/home/runner/work/altcover/altcover/packages/nunit.consolerunner/3.12.0/tools/nunit3-console.exe --noheader --work=. --result=./_Reports/VisualizerTestWithAltCoverRunnerReport.xml /home/runner/work/altcover/altcover/_Binaries/AltCover.Visualizer.Tests/Debug+AnyCPU/net472/__VisualizerTestWithAltCoverRunner/AltCover.Tests.Visualizer.dll'
Runtime Environment
   OS Version: Linux 6.5.0.1017 
   Runtime: .NET Framework CLR v4.0.30319.42000
...

Without doing the test run under the control of the runner, but just at a command line, does plain

/usr/bin/vstest.console.exe /source/test/bin/Debug/AltCover/MyTest.dll

run the tests?

If it does, then a work-around would be to run the tests like that and use

altcover runner --collect --recorderDirectory=/source/test/bin/Debug/AltCover --outputFile=/source/test/bin/Debug/reportDir/finalReport.xml

If it silently does nothing, than that would be the problem

SteveGilham commented 2 months ago

Any updates, or shall I close this?

maurosoft1973 commented 2 months ago

Ok, close issue

Il Lun 29 Apr 2024, 09:10 Steve Gilham @.***> ha scritto:

Any updates, or shall I close this?

— Reply to this email directly, view it on GitHub https://github.com/SteveGilham/altcover/issues/218#issuecomment-2082026540, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKKONVZNENLR23XP6JWC2DY7XW4TAVCNFSM6AAAAABGHQBZHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBSGAZDMNJUGA . You are receiving this because you authored the thread.Message ID: @.***>