haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
663 stars 96 forks source link

Code Coverage #391

Closed HurricanKai closed 3 years ago

HurricanKai commented 3 years ago

Is there any way of collecting code coverage?

haf commented 3 years ago

Maybe something like this? https://github.com/coverlet-coverage/coverlet#usage

If you follow the template, you'll have the SDK for tests referenced, and then dotnet test works with Expecto. Try it; it should work, since we're just calling into .Net.

HurricanKai commented 3 years ago

Hmm, I thought I tried that, but it didn't work. Will try again, maybe I did something wrong. Will report back, thanks

haf commented 3 years ago

I'm happy to look into it and make sure it works in return for payment of the time it takes me.

baronfel commented 3 years ago

Something similar is known to work. MiniScaffold has code coverage setup for expecto tests + AltCover (instead of coverlet), but the principles are the same. You need test SDKs and the coverage tool, and then when you run tests you supply some coverage parameters, and finally turn the output into viewable reports

HurricanKai commented 3 years ago

Hmm, all I get from codecov is

<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="1" branch-rate="1" version="1.9" timestamp="1594915816" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0">
  <sources />
  <packages />
</coverage>
HurricanKai commented 3 years ago

altcover has worked for me. Thanks :)