SamAmco / track-and-graph

An android app for tracking personal data and creating custom graphs
GNU General Public License v3.0
438 stars 40 forks source link

[integration test] Idea: Restore-Backup-Restore test #166

Open stheid opened 2 years ago

stheid commented 2 years ago

... with a couple of sample databases

I found out some quirks with the restoring mechanism which gave me the idea that its probably a good idea to make sure the backup and restoring mechanism always works. This will also test database migration as restoring an old database will also trigger that.

SamAmco commented 2 years ago

Yeah definitely not a bad idea to have tests for backup/restoration both for CSV and databases. My issue is just time. Every time i change the database i need to write/fix tests which can slow down development too much. There is a file where migration tests are supposed to go but it's woefully underdeveloped: app/src/androidTest/java/com/samco/trackandgraph/MigrationTests.kt

stheid commented 2 years ago

The idea i think about would not need much maintainance i guess, because it should be always possible to restore old/outdated databases and if there are a couple of samples it should at least trigger stupid bugs, hopefully also ones that are related to migrations. I will have a look if i find time in the next weeks do to something about it. In the future i will create the issues that are mainly for my own development whishes in my fork and continue to send the PRs to this issue. (dont worry i dont plan to fork, i love what you did so far, but i just dont want to bloat the "official issues" with my ideas ;)

SamAmco commented 2 years ago

Yeah this is something you could do. I wonder how useful this is though if you don't then write new tests every time the database migrates to make sure that the old data has been converted to the new structure correctly. Again this is totally something I should be doing anyway. I certainly take your point that it would be nice to have a sense check test though just to make sure it doesn't crash immediately.

stheid commented 2 years ago

I mean fine grained tests are always better than coarse grained, but coarse grained are better than no tests :D