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

Add local tests to project #129

Merged
merged 8 commits into from
Dec 22, 2023
Merged

Conversation

Irineu333
Copy link
Member

@Irineu333 Irineu333 commented Dec 17, 2023

Description

The implementation of tests is crucial to prevent regressions and accelerate development. This pull request represents a significant step towards full test coverage in Speak Touch.

Given that the SpeakTouch code intensely interacts with the Android framework APIs, local tests isolated from the Android framework are not viable. One option would be to simulate these structures with Mockito or Mockk. However, although valid, this approach requires the developer to code the simulated structures, which will most likely not reflect the actual behavior, but rather the developer's expectations. Therefore, I opted to use Robolectric to simulate the Android framework locally. This approach seems more effective and aligned with the application's real behavior. My experience with Robolectric was surprisingly positive, especially due to the ease of creating tests with it

Improvements

  • Added local tests for Type

@Irineu333 Irineu333 added this to the MVP milestone Dec 17, 2023
@Irineu333 Irineu333 requested a review from PatrykMis December 17, 2023 07:21
@Irineu333 Irineu333 self-assigned this Dec 17, 2023
@Irineu333 Irineu333 linked an issue Dec 17, 2023 that may be closed by this pull request
@Irineu333 Irineu333 changed the title Add test to project Add local tests to project Dec 17, 2023
@Irineu333 Irineu333 force-pushed the feature/ISSUE47-add-test-to-project branch from 8080b67 to 2965f7c Compare December 17, 2023 08:41
@Irineu333 Irineu333 force-pushed the feature/ISSUE47-add-test-to-project branch from 2965f7c to ca0ab7a Compare December 17, 2023 08:45
@PatrykMis PatrykMis force-pushed the feature/ISSUE47-add-test-to-project branch from 5b46d1d to 91a30b9 Compare December 20, 2023 06:52
Copy link
Collaborator

@PatrykMis PatrykMis 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! I've performed some cleanup regarding example tests and example instrumented tests, noticing that you removed the runners dependency. Additionally, I've updated the dependencies to avoid creating unnecessary pull requests, as everything will be reflected in the commit history.

@Irineu333
Copy link
Member Author

@coderabbitai review

Copy link

coderabbitai bot commented Dec 21, 2023

Walkthrough

The project's testing configuration has been overhauled, particularly for Android unit testing. The update includes a new Gradle run configuration for metadata, improvements to build scripts, and the introduction of custom view tests. Notably, there's a shift from instrumented tests to local unit tests with Robolectric, as seen in the build.gradle.kts and test classes.

Changes

File Path Change Summary
.idea/runConfigurations/... Added "Update metadata" Gradle run configuration.
app/build.gradle.kts Removed testInstrumentationRunner, added testOptions, updated buildTypes, and switched to testImplementation.
app/src/test/java/com/.../TypeTest.kt Added tests for UI element type identification.
app/src/test/java/com/.../CustomCheckable.kt Created a custom checkable view class with accessibility.
app/src/test/java/com/.../CustomList.kt Created a custom list view class with specialized accessibility.
test/build.gradle.kts Removed testInstrumentationRunner and test-related dependencies.

Poem

In the burrow of code, a change does leap,
Tests now run where the Robolectric peep.
With views so custom, they check with care,
🐇 A rabbit's touch, with flair to spare. 🎩✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

coderabbitai[bot]

This comment was marked as spam.

@Irineu333
Copy link
Member Author

Irineu333 commented Dec 21, 2023

@PatrykMis I'm testing CodeRabbit on the project, do you like it? It's a free AI code review tool for open source projects.

@PatrykMis
Copy link
Collaborator

@Irineu333 it's a great tool which, as I see, summarizes changes made in pull requests, it is also capable to see them in context of linked issues.

And what about integrating SonarCloud?

@Irineu333 Irineu333 merged commit f10c984 into develop Dec 22, 2023
2 checks passed
@Irineu333 Irineu333 deleted the feature/ISSUE47-add-test-to-project branch December 22, 2023 22:07
@Irineu333
Copy link
Member Author

Irineu333 commented Dec 24, 2023

I was a bit disappointed with the CodeRabbit. I thought it could point out potential problems in the code like a reviewer, but the comments are very generic (see #128). In this PR, it just summarized the changes.

Regarding SonarCloud, I will study it.

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.

Add local tests to project
2 participants