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

ci: improve test coverage and add snapshot tests for object conditions #291

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

alexanderlinne
Copy link
Collaborator

@alexanderlinne alexanderlinne commented Aug 24, 2024

With this PR we add new test cases for methods defined in ArchUnitNET/Fluent/Syntax/Elements/ObjectsShould.cs and ArchUnitNET/Fluent/Syntax/Elements/ObjectConditionsDefinition.cs that achieves the following:

  • We achieve full line coverage and nearly full branch coverage by testing a larger subset of the interface and more combinations of arguments
  • We allow for the detection of regressions in the error messages by adding snapshot tests
  • The new tests have an improved execution time compared to the older tests, because we do not use the whole ArchUnitNETTests assembly as the architecture for our tests. Instead, we add separate assemblies that contain a small number of types. This reduces the number of hits per line from hundreds or thousands to usually less than ten.

The new tests will replace tests in ArchUnitNETTests/Fluent/Syntax/Elements/ObjectSyntaxElementsTests.cs, but to remove these tests without reducing the code coverage, additional tests for ArchUnitNET/Fluent/Syntax/Elements/ObjectPredicatesDefinition.cs will be needed.

Relates to #229, providing a way to check for changes to the error messages in pull requests

@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.37%. Comparing base (0ebfbdf) to head (a428ef6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #291      +/-   ##
==========================================
+ Coverage   56.70%   65.37%   +8.66%     
==========================================
  Files         254      254              
  Lines       22842    22842              
  Branches     1938     1938              
==========================================
+ Hits        12953    14932    +1979     
+ Misses       9334     7368    -1966     
+ Partials      555      542      -13     

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

@alexanderlinne alexanderlinne marked this pull request as draft August 25, 2024 08:19
@alexanderlinne alexanderlinne marked this pull request as ready for review August 26, 2024 19:47
Signed-off-by: Alexander Linne <[email protected]>
mak638
mak638 previously approved these changes Aug 31, 2024
Signed-off-by: Alexander Linne <[email protected]>
Signed-off-by: Alexander Linne <[email protected]>
@alexanderlinne alexanderlinne merged commit 09fae24 into main Sep 3, 2024
9 checks passed
@alexanderlinne alexanderlinne deleted the ci/object-condition-tests branch September 3, 2024 14:38
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