-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Code Coverage for Affected Projects only #12
Comments
Hi Leonardo. |
Hi @nvsoares , we are quite close of having this implemented.
The plan is to be able to output Corvelet I can't confirm when I will be able to implement this feature, so would you guys considering contributing an |
Hi @leonardochaia. We are implementing an OutputFormatter for Coverlet when used with MSBuild. First, we have changed the ProjectInfo class to include the AssemblyName.
Then, we have created the CoverletIncludeOutputFormatter like this:
If I understand, the idea is to pass the content of the created file to |
Hey @nvsoares , looking good 👍 I think the output should be the filter expression (like dotnet affected <....> -f corvelet
dotnet test affected.proj /p:CollectCoverage=true /p:Include=(cat corvelet.txt) I haven't tested this to check the filter expression works but we want all types from all affected assemblies so I think it should be something like according to filter docs
|
Hi @leonardochaia.
If the changes are only to .2, then this is the only affected project. However, it is not this one that we should put in the include filter, but .1. Do you have any idea what we should do? |
Hmm, interesting but yes makes sense. Basically it expects the "test covered project" as the filter target, instead of the "project that has the tests". Makes sense. So, haven't really thought this trough but it looks like we need to compose a filter that includes all projects that .2 references In which case it looks like the formatter needs to know the ReferencingProjects in order to compose the filter. I think we may need to expand ProjectInfo to include the flat list of ReferencingProjects. I may be able to take a look in the upcoming days. |
I think that include all references does not solve all the cases.
The only affected project is the .4. So, we will run the tests only for project .4.
The total coverage will be 50%, since the testing of the .1 project has not been run. The only solution I have in mind is to use some convention in the naming of the test projects or have some sort of configuration file. |
Hmmm I see..
What if the formatter filters out the 4. ReferencingProjects to only include the ReferencingProjects that were built? Sorry for the vague responses but I think I need to sit down a bit and think this through with some dummy repo to see how it behaves. EDIT: right they were not built so this does not work |
Hello Leonardo. |
Hi @nvsoares @JoaoEdu93 , sorry I have not been able to review this yet. Been having some busy weeks at work / life. Regards, |
When testing only what's affected, the coverage report will show incorrect results.
For example, given this project structure:
If .2 has changes, .3 will be affected so we will build and test .2 and .3, but there's no need to test .4 since .1 has not changed.
Hence, the coverage report will show a low coverage percentage for .1 since its test have not run
We should be able to filter down the coverage report to only include the resulting projects of dotnet-affected.
The text was updated successfully, but these errors were encountered: