-
Notifications
You must be signed in to change notification settings - Fork 5
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
JN-1059 existing user import updates #898
Conversation
core/src/main/java/bio/terra/pearl/core/service/export/EnrolleeImportService.java
Outdated
Show resolved
Hide resolved
@@ -73,23 +74,73 @@ public class EnrolleeImportServiceTests extends BaseSpringBootTest { | |||
@Test | |||
@Transactional | |||
public void testImportEnrolleesCSV(TestInfo info) { | |||
//tests new import and update import |
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.
combined new import and then update test cases too.
Maybe they can be separated but didnt wanted to reuse already populated test portal/study env
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.
not sure I agree -- seems like this test is now too long. Could you pull the first part of the method into a helper method "setupImportTest()" And then have one test that tests a single import, and then an separate test that tests updates?
(sampath) separated out into 3 separate tests.
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.
+1 Devon, I don't think these should be combined- it feels like this is pushing past the limits of what could be considered a "unit" test
assertThat(userUpdated2.getId(), equalTo(user.getId())); | ||
Assertions.assertNotEquals(enrollee.getId(), enrolleeUpdated2.getId()); | ||
Assertions.assertNotEquals(enrollee.getProfileId(), enrolleeUpdated2.getProfileId()); | ||
|
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.
same portal, different study wasn't tested here as of now
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.
yup, you were right that the code could use some cleanup -- also consider some more general test helpers -- we'll be writing a lot of tests for this over the next month :)
core/src/main/java/bio/terra/pearl/core/service/export/EnrolleeImportService.java
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
private Import importAndVerify(StudyEnvironmentFactory.StudyEnvironmentBundle bundle, AdminUser admin, String csvString, |
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 took me a long time to figure out what this method did. Consider renaming, adding a comment, and also renaming the "birthDate" parameter to clarify which birthdate
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.
Better yet, consider splitting out an "Import" helper method, and then a series of "verifyImportEnrollees" "verifyImportParticipantUsers" "verifySurveyResponses" methods. Each method would take as arguments an Import and an array of hamcrest Matchers. this should reduce the amount of hardcoded strings.
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.
Took care of most except "array of hamcrest Matchers" which I will look into separately.
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.
refactored to pass objects rather than individual attributes so that it looks good with more attributes from ParticipantUser/Enrolle/Profile
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.
Some test cleanups that would be nice, but not blocking
core/src/test/java/bio/terra/pearl/core/service/export/EnrolleeImportServiceTests.java
Outdated
Show resolved
Hide resolved
@@ -73,23 +74,73 @@ public class EnrolleeImportServiceTests extends BaseSpringBootTest { | |||
@Test | |||
@Transactional | |||
public void testImportEnrolleesCSV(TestInfo info) { | |||
//tests new import and update import |
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.
not sure I agree -- seems like this test is now too long. Could you pull the first part of the method into a helper method "setupImportTest()" And then have one test that tests a single import, and then an separate test that tests updates?
(sampath) separated out into 3 separate tests.
core/src/main/java/bio/terra/pearl/core/service/export/EnrolleeImportService.java
Outdated
Show resolved
Hide resolved
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.
Looks good pending resolution of latest comments 👍
@@ -73,23 +74,73 @@ public class EnrolleeImportServiceTests extends BaseSpringBootTest { | |||
@Test | |||
@Transactional | |||
public void testImportEnrolleesCSV(TestInfo info) { | |||
//tests new import and update import |
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.
+1 Devon, I don't think these should be combined- it feels like this is pushing past the limits of what could be considered a "unit" test
Quality Gate passedIssues Measures |
DESCRIPTION (include screenshots, and mobile screenshots for participant UX)
While importing check for participant existence and handle as update
TO TEST: (simple manual steps for confirming core behavior -- used for pre-release checks)
Use attached heartdemo -v1, v2 files and hearthive v1, v2 files for testing.
load hd-v1; make sure import looks good;
load hd-v2; import should go through and existing enrollees/participants should be updated; same profile
load hh-v1; import should go through; same participants (no new participants should be created; new enrollees should be created with new profile since diff portal;
load hh-v2; hh enrollees should be updated;
Dont have test files for same portal, same participant but different study.
2024-05-17-enrollees-hd-v1.csv
2024-05-17-enrollees-hd-v2.csv
2024-05-17-enrollees-hh-v1.csv
2024-05-17-enrollees-hh-v2.csv