-
Notifications
You must be signed in to change notification settings - Fork 40
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
Merge all values of the hierarchy using max
#27
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/test/resources/edu/hm/hafner/coverage/parser/cobertura-merge-a.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" ?> | ||
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd"> | ||
<coverage lines-valid="4161" lines-covered="3788" line-rate="0.9103" branches-valid="1243" branches-covered="1032" branch-rate="0.8301999999999999" timestamp="1689142471140" complexity="0" version="0.1"> | ||
<sources> | ||
<source>${MY_DIRECTORY_PLACEHOLDER}</source> | ||
</sources> | ||
<packages> | ||
<package name="src.app.utils" line-rate="0.9923000000000001" branch-rate="0.9516"> | ||
<classes> | ||
<class name="dateUtils.ts" filename="src\app\utils\dateUtils.ts" line-rate="1" branch-rate="0.6666"> | ||
<methods> | ||
<method name="getTimeAgo" hits="43" signature="()V"> | ||
<lines> | ||
<line number="35" hits="43"/> | ||
</lines> | ||
</method> | ||
<method name="(anonymous_1)" hits="31" signature="()V"> | ||
<lines> | ||
<line number="40" hits="31"/> | ||
</lines> | ||
</method> | ||
<method name="isValidDate" hits="84" signature="()V"> | ||
<lines> | ||
<line number="71" hits="84"/> | ||
</lines> | ||
</method> | ||
</methods> | ||
<lines> | ||
<line number="1" hits="23" branch="false"/> | ||
<line number="5" hits="23" branch="false"/> | ||
<line number="6" hits="23" branch="false"/> | ||
<line number="7" hits="23" branch="false"/> | ||
<line number="8" hits="23" branch="false"/> | ||
<line number="9" hits="23" branch="false"/> | ||
<line number="10" hits="23" branch="false"/> | ||
<line number="11" hits="23" branch="false"/> | ||
<line number="20" hits="23" branch="false"/> | ||
<line number="35" hits="23" branch="false"/> | ||
<line number="36" hits="43" branch="false"/> | ||
<line number="37" hits="43" branch="true" condition-coverage="100% (1/1)"/> | ||
<line number="38" hits="34" branch="false"/> | ||
<line number="40" hits="31" branch="true" condition-coverage="50% (1/2)"/> | ||
<line number="41" hits="9" branch="false"/> | ||
<line number="42" hits="9" branch="false"/> | ||
<line number="45" hits="23" branch="false"/> | ||
<line number="54" hits="23" branch="false"/> | ||
<line number="60" hits="23" branch="false"/> | ||
<line number="66" hits="23" branch="false"/> | ||
<line number="71" hits="23" branch="false"/> | ||
<line number="72" hits="84" branch="false"/> | ||
</lines> | ||
</class> | ||
</classes> | ||
</package> | ||
</packages> | ||
</coverage> |
56 changes: 56 additions & 0 deletions
56
src/test/resources/edu/hm/hafner/coverage/parser/cobertura-merge-b.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" ?> | ||
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd"> | ||
<coverage lines-valid="544" lines-covered="487" line-rate="0.8952" branches-valid="164" branches-covered="130" branch-rate="0.7926000000000001" timestamp="1689142282020" complexity="0" version="0.1"> | ||
<sources> | ||
<source>${MY_DIRECTORY_PLACEHOLDER}</source> | ||
</sources> | ||
<packages> | ||
<package name="src.app.utils" line-rate="0.8378" branch-rate="0"> | ||
<classes> | ||
<class name="dateUtils.ts" filename="src\app\utils\dateUtils.ts" line-rate="0.7272" branch-rate="0"> | ||
<methods> | ||
<method name="getTimeAgo" hits="0" signature="()V"> | ||
<lines> | ||
<line number="35" hits="0"/> | ||
</lines> | ||
</method> | ||
<method name="(anonymous_1)" hits="0" signature="()V"> | ||
<lines> | ||
<line number="40" hits="0"/> | ||
</lines> | ||
</method> | ||
<method name="isValidDate" hits="1070" signature="()V"> | ||
<lines> | ||
<line number="71" hits="1070"/> | ||
</lines> | ||
</method> | ||
</methods> | ||
<lines> | ||
<line number="1" hits="1" branch="false"/> | ||
<line number="5" hits="1" branch="false"/> | ||
<line number="6" hits="1" branch="false"/> | ||
<line number="7" hits="1" branch="false"/> | ||
<line number="8" hits="1" branch="false"/> | ||
<line number="9" hits="1" branch="false"/> | ||
<line number="10" hits="1" branch="false"/> | ||
<line number="11" hits="1" branch="false"/> | ||
<line number="20" hits="1" branch="false"/> | ||
<line number="35" hits="1" branch="false"/> | ||
<line number="36" hits="0" branch="false"/> | ||
<line number="37" hits="0" branch="true" condition-coverage="0% (0/1)"/> | ||
<line number="38" hits="0" branch="false"/> | ||
<line number="40" hits="0" branch="true" condition-coverage="0% (0/2)"/> | ||
<line number="41" hits="0" branch="false"/> | ||
<line number="42" hits="0" branch="false"/> | ||
<line number="45" hits="1" branch="false"/> | ||
<line number="54" hits="1" branch="false"/> | ||
<line number="60" hits="1" branch="false"/> | ||
<line number="66" hits="1" branch="false"/> | ||
<line number="71" hits="1" branch="false"/> | ||
<line number="72" hits="1070" branch="false"/> | ||
</lines> | ||
</class> | ||
</classes> | ||
</package> | ||
</packages> | ||
</coverage> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this functionality it's still a replace right? It just takes the coverage that's higer.
If there is a file with the functions
a
andb
, coverage X covers funca
and coverage Y covers functionb
, it's 50% overall coverage instead of 100% right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still not clear on how to merge inner nodes 😞
The code works for leaves but not for inner nodes yet. I can drop the details of inner nodes and compute them on my own but that will cause other problems...
Do you have an idea on how to implement this correctly? I do not see a solution for this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much experience with coverage reports, but by just looking at the cobertura one, I would expect that the lines should be merged (identified by number and branch) and
hits > 0
should be preferredThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding some more tests it looks that the merge using
max
is working correctly.No, since each file has a coverage for X and Y. So X contains a=100% and b=0%, and Y contains a=0% and b=100%, then the max will produce a=100% and b=100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it's more correct than before.
Lets say we have function A.
If you have two separate coverage reports, one with the file
x.spec.test
that testsA
only withtrue
and one with the filey.spec.test
that testsA
only withfalse
, then both of them would have the same coverage (about 50%) and the code-coverage-api would return 50% right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the coverage is not measured per method, it is line based. The coverage per method is computed from the line coverage. So you should get a 100% coverage in total.