Skip to content
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

Test coverage #182

Merged
merged 4 commits into from
Apr 16, 2024
Merged

Test coverage #182

merged 4 commits into from
Apr 16, 2024

Conversation

johnml1135
Copy link
Collaborator

@johnml1135 johnml1135 commented Apr 11, 2024

#181


This change is Reviewable

@johnml1135 johnml1135 requested a review from ddaspit April 11, 2024 19:51
@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.09%. Comparing base (f1fcf56) to head (a19b9d2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #182      +/-   ##
==========================================
+ Coverage   67.04%   67.09%   +0.05%     
==========================================
  Files         441      441              
  Lines       34831    34826       -5     
  Branches     4670     4669       -1     
==========================================
+ Hits        23351    23368      +17     
+ Misses      10387    10365      -22     
  Partials     1093     1093              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@johnml1135 johnml1135 requested review from Enkidu93 and removed request for ddaspit April 12, 2024 13:31
Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Enkidu93 and @johnml1135)


tests/SIL.Machine.AspNetCore.Tests/SIL.Machine.AspNetCore.Tests.csproj line 16 at r1 (raw file):

	<ItemGroup>
		<PackageReference Include="coverlet.msbuild" Version="6.0.2">

What is the difference between this package and coverlet.collector?


tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 55 at r1 (raw file):

    [TestCase]
    public void CompareTemplate()

I don't quite understand what this test is buying us. It seems to be mostly testing List.Sort and HashSet.


tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 78 at r1 (raw file):

    [TestCase("MAT 1:0/1:esb", "MAT 1:0/1:esb/1:p", ExpectedResult = false, Description = "NonVerseParentChild")]
    [TestCase("MAT 1:0/1:p/2:esb", "MAT 1:0/2:esb/1:p", ExpectedResult = false, Description = "NonVerseParentChild")]
    public bool Overlaps(string ref1Str, string ref2Str)

I don't think Overlaps is being used, so I wanted to remove it.


tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 99 at r1 (raw file):

            Assert.That(!ref1.Equals(obj1));
        });
        Assert.Throws<ArgumentException>(() => ref1.CompareTo(obj1));

This should be a separate test.

@johnml1135
Copy link
Collaborator Author

tests/SIL.Machine.AspNetCore.Tests/SIL.Machine.AspNetCore.Tests.csproj line 16 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

What is the difference between this package and coverlet.collector?

This can be run locally to assess coverage. It helps me when I write tests to verify that the coverage I expect is the coverage that I get.

@johnml1135
Copy link
Collaborator Author

tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 55 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

I don't quite understand what this test is buying us. It seems to be mostly testing List.Sort and HashSet.

this tests the IComparable.CompareTo method

@johnml1135
Copy link
Collaborator Author

tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 78 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

I don't think Overlaps is being used, so I wanted to remove it.

Removed.

@johnml1135
Copy link
Collaborator Author

tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 99 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

This should be a separate test.

Done

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Enkidu93 and @johnml1135)


tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 55 at r1 (raw file):

Previously, johnml1135 (John Lambert) wrote…

this tests the IComparable.CompareTo method

We are already testing the CompareTo method. We can just remove these tests.

@johnml1135
Copy link
Collaborator Author

tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 55 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

We are already testing the CompareTo method. We can just remove these tests.

Yes for public int CompareTo(object obj), no for int IComparable<ScriptureRef>.CompareTo(ScriptureRef other). It is just a little thing, but I wanted to make sure it was covered.

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Enkidu93 and @johnml1135)


tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 55 at r1 (raw file):

Previously, johnml1135 (John Lambert) wrote…

Yes for public int CompareTo(object obj), no for int IComparable<ScriptureRef>.CompareTo(ScriptureRef other). It is just a little thing, but I wanted to make sure it was covered.

If you want to test that method, then test it directly. I think it is unnecessary and only creates more tests that need to be maintained for almost no benefit. You can test it directly by referencing the instance using the interface, i.e.

int result = ((IComparable<ScriptureRef>)ref1).CompareTo(ref2);

@johnml1135
Copy link
Collaborator Author

tests/SIL.Machine.Tests/Corpora/ScriptureRefTests.cs line 55 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

If you want to test that method, then test it directly. I think it is unnecessary and only creates more tests that need to be maintained for almost no benefit. You can test it directly by referencing the instance using the interface, i.e.

int result = ((IComparable<ScriptureRef>)ref1).CompareTo(ref2);

Ah, I was trying to access it directly and didn't know the syntax. thanks! I'll update the the test.

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Enkidu93)

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johnml1135)

@johnml1135 johnml1135 merged commit 707d7dc into master Apr 16, 2024
4 checks passed
@ddaspit ddaspit deleted the test_coverage branch April 22, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants