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

Set up automated tests for the Nappa library #100

Open
sshann opened this issue Jul 10, 2020 · 0 comments
Open

Set up automated tests for the Nappa library #100

sshann opened this issue Jul 10, 2020 · 0 comments
Labels
project:library Issues related to the prefetch library for Android

Comments

@sshann
Copy link
Collaborator

sshann commented Jul 10, 2020

Manually testing if the plugin works take time, requires an existent Android project and might miss some cases.

Automated tests ensure that the plugin covers all test cases and is working correctly.

If a CI/CD pipeline is implemented, the automated tests can be run when commits are pushed and inform if a change makes a test to fail, thus ensuring that PRs will not break the plugin.

In order to test the Nappa library, we need to have test data. Creating data at runtime takes too much effort, is prone to error and has no representation of a real/simulated case of a NAPPA enabled app.

A possible solution is to use a test app with Nappa enabled and export the nappa.db database via the Device File Explorer in Android Studio. With this file, we have 2 possibilities:

  1. Import a file .db in our tests
  2. Export a SQL dump from the file .db containing the schema creation and the inserted data. This dump is then executed once before running any test.

I am not sure if option 1 is possible, but I personally prefer option 2, since if we change (and likely will change) the database schema, we can easily apply migrations to ensure that our test data is equivalent to the current Room schema.

This method brings the following benefits:

  • The test data is deterministic and so should be the test outcome
  • Minimal effort in creating the data
  • It is easier to debug the data;
@sshann sshann added the project:library Issues related to the prefetch library for Android label Jul 10, 2020
sshann added a commit to VU-Thesis-2019-2020-Wesley-Shann/NAPPA that referenced this issue Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project:library Issues related to the prefetch library for Android
Projects
None yet
Development

No branches or pull requests

1 participant