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(openchallenges): improve organization service model entity unit test coverage #2389

Merged

Conversation

mdsage1
Copy link
Contributor

@mdsage1 mdsage1 commented Dec 5, 2023

Description

Sonar unit organization service test coverage has been increased to 45% for model/entity package by writing unit tests for a single class, OrganizationEntity.

Related Issue

#2063
#1528
#2348
#2388

Changelog

See files Changed section

These changes have increased the Sonar coverage from the 15% achieved with the exception unit test PR #2348 (9.45% overall). These tests were written last week and debugged this week. The PR has been released after the approval of the exception unit test PR on 2023-12-04.

Preview

Overall sonar coverage has increased to 50%, from 0%, for organization service model entity.

The Sonar coverage increase for model/mapper:
image

The goal was to get organization-service > 30% and I will confirm this once the PR has been merged. Given that the Sonar coverage calculation is 15% higher than the intended coverage it's possible that the Code Quality Dashboard will reflect 30% code coverage with the updates made to this class.

@mdsage1 mdsage1 self-assigned this Dec 5, 2023
@mdsage1
Copy link
Contributor Author

mdsage1 commented Dec 5, 2023

@tschaffter Do you feel this covers #1528? Or were you thinking about another class when creating this? This is intended to be reviewed after #2388 but were created during the same week.

@mdsage1 mdsage1 marked this pull request as ready for review December 5, 2023 20:32
@mdsage1
Copy link
Contributor Author

mdsage1 commented Dec 6, 2023

Changes implemented:

  1. Updated organizationEntity to entity in tests with a single entity
  2. Changed all occurrences of retrieved in variable names to actual
  3. TBD on how to implement @BeforeAll w/o throwing errors

@mdsage1 mdsage1 marked this pull request as draft December 6, 2023 00:08
@mdsage1
Copy link
Contributor Author

mdsage1 commented Dec 8, 2023

Changes made to condense the code and avoid repitition led to a slight increase in Sonar coverage for to 51%.

image

@mdsage1 mdsage1 marked this pull request as ready for review December 8, 2023 19:55
@mdsage1 mdsage1 marked this pull request as draft December 19, 2023 22:27
@mdsage1
Copy link
Contributor Author

mdsage1 commented Jan 3, 2024

Organization entity properties, login and email, were removed during PR #2399 which caused the OrganizationEntityTest.java unit tests to fail. Removed the unit tests related to the Organization Entity login and email properties. Sonar coverage was reduced to 48%.
image

@mdsage1 mdsage1 marked this pull request as ready for review January 3, 2024 18:07
@mdsage1 mdsage1 marked this pull request as draft January 9, 2024 20:48
@mdsage1 mdsage1 marked this pull request as ready for review January 10, 2024 19:07
@mdsage1
Copy link
Contributor Author

mdsage1 commented Feb 9, 2024

@tschaffter This is ready for you to review. I made the changes you asked for:

Implemented the following changes:

  1. Changed the unit test name from EqualsObject_ShouldReturnBoolean_WhenPassedTwoObjects to EqualsObject_ShouldBeTheSame_WhenPassedTwoIdenticalObjects
  2. Separated that test into 2 smaller tests 1 test differentiates between two different objects and the other recognizes two objects as being identical.

@tschaffter
Copy link
Member

Update 2024-02-13

I tried to push changes to this PR but git didn't offer me this option unlike when attempting to push to Verena's and Rong's PR. I wanted to delete the file that only include commented content. I will now merge this PR and make the change later.

@tschaffter tschaffter merged commit 1c1c19d into Sage-Bionetworks:main Feb 13, 2024
7 checks passed
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.

2 participants