Create a test database for the NAPPA library
github-actions opened this issue · comments
Create a test database for the NAPPA library
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.
Verify possibility of importing an actual mydatabase.db
SQLite file.
This file can be easily obtained by using the application in a NAPPA enabled app.
This method brings the following benefits:
-
The test data is deterministic;
-
Little effort in creating the data;
-
Tests run faster since the data do not need to be created --> valid for a huge amount of data;
-
It is easier to debug the data;
If it is not possible to import a *.db
file, investigate alternative approaches.
Implementing unit and integration tests allows to ensure the quality and correctness of
the NAPPA library. It is also easier to test the application: instead of importing the library
to the app and manually testing it, these tests allows to run automated tests.
The only aspect that is difficult to test with this method is changes in the database
schema. For existent test data, the test database could be manually updated, but I would
suggest just recreating the data.
import static org.junit.Assert.*;
// TODO Create a test database for the NAPPA library
// 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.
// Verify possibility of importing an actual `mydatabase.db` SQLite file.
// This file can be easily obtained by using the application in a NAPPA enabled app.
// This method brings the following benefits:
// * The test data is deterministic;
// * Little effort in creating the data;
// * Tests run faster since the data do not need to be created --> valid for a huge amount of data;
// * It is easier to debug the data;
// If it is not possible to import a `*.db` file, investigate alternative approaches.
// Implementing unit and integration tests allows to ensure the quality and correctness of
// the NAPPA library. It is also easier to test the application: instead of importing the library
// to the app and manually testing it, these tests allows to run automated tests.
// The only aspect that is difficult to test with this method is changes in the database
// schema. For existent test data, the test database could be manually updated, but I would
// suggest just recreating the data.
/**
* Instrumented test, which will execute on an Android device.
*
eleted file mode 100644
ndex be8fce4..0000000
++ /dev/null
91e685ebe9fe4a65fc605264b52ade3d8dac9514