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

chore(tests): support vintage engine (junit4) and add robolectric (ACOL-139) #2662

Merged
merged 9 commits into from
Feb 6, 2024

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Feb 5, 2024

TopicACOL-139 Min. code coverage thresholds


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

We want to increase the code covereage, so to do so we can add tests with robolectric to cover more cases

Causes (Optional)

Decided in the android collective.

Solutions

  • Support/adds junit5 vintage engine, enabling writing junit4 tests (robolectric runs on junit4 only)
  • Add robolectric and the first test with it.
  • Many tests were not runninig, having an invisible coverage, after configure it correctly for them to run, some tests were failing, fixed that as well;

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@yamilmedina yamilmedina requested a review from a team February 5, 2024 17:27
@yamilmedina yamilmedina self-assigned this Feb 5, 2024
@yamilmedina yamilmedina requested review from alexandreferris, vitorhugods, mchenani, ohassine and saleniuk and removed request for a team February 5, 2024 17:27
@pull-request-size pull-request-size bot added size/XS and removed size/S labels Feb 5, 2024
@yamilmedina yamilmedina changed the title chore: support vintage engine (junit4) and adds robolectric (ACOL-139) chore: support vintage engine (junit4) and add robolectric (ACOL-139) Feb 5, 2024
Copy link
Contributor

github-actions bot commented Feb 5, 2024

Test Results

812 tests  +17   812 ✅ +17   10m 54s ⏱️ - 3m 38s
112 suites + 4     0 💤 ± 0 
112 files   + 4     0 ❌ ± 0 

Results for commit a0bbaa6. ± Comparison against base commit fe78d52.

♻️ This comment has been updated with latest results.

@AndroidBob
Copy link
Collaborator

Build 2880 failed.

@@ -48,7 +48,7 @@ class UserTypeMapperTest {
@Test
fun `given internal as a user type correctly map to none as membership`() {
val result = userTypeMapper.toMembership(UserType.INTERNAL)
assertEquals(Membership.None, result)
assertEquals(Membership.Standard, result)
Copy link
Contributor Author

@yamilmedina yamilmedina Feb 5, 2024

Choose a reason for hiding this comment

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

These class tests were not running, since the annotations were junit4, being skipped.
Now is running with this PR and this particular check was broken.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 5, 2024
@AndroidBob
Copy link
Collaborator

Build 2882 failed.

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

Great addition 💪🏻

just a question about the commented tests

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

👌🏻

@@ -174,7 +174,11 @@ class EditGuestAccessViewModel @Inject constructor(
)
)

is UpdateConversationAccessRoleUseCase.Result.Success -> Unit
is UpdateConversationAccessRoleUseCase.Result.Success -> updateState(
Copy link
Contributor Author

@yamilmedina yamilmedina Feb 6, 2024

Choose a reason for hiding this comment

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

After fixing the ignored tests, this test was failing, because we were not explicitly updating the State in the success case. Test caught this unexpected behavior in a TDD-like fashion

@yamilmedina yamilmedina changed the title chore: support vintage engine (junit4) and add robolectric (ACOL-139) chore(tests): support vintage engine (junit4) and add robolectric (ACOL-139) Feb 6, 2024
@AndroidBob
Copy link
Collaborator

Build 2896 failed.

Copy link
Contributor

github-actions bot commented Feb 6, 2024

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 2898 succeeded.

The build produced the following APK's:

@yamilmedina yamilmedina enabled auto-merge February 6, 2024 13:06
Copy link
Member

@MohamadJaara MohamadJaara left a comment

Choose a reason for hiding this comment

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

Great work 👍🏼

@yamilmedina yamilmedina added this pull request to the merge queue Feb 6, 2024
Copy link
Contributor

github-actions bot commented Feb 6, 2024

APKs built during tests are available here. Scroll down to Artifacts!

Merged via the queue into develop with commit 1889535 Feb 6, 2024
11 of 12 checks passed
@yamilmedina yamilmedina deleted the chore/support-vintagejunit4 branch February 6, 2024 15:12
@AndroidBob
Copy link
Collaborator

Build 2922 failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants