Testing - PhenoApps/Coordinate GitHub Wiki
The purpose of this page is to make developer testing of Coordinate easier. The page makes testing easier by describing what successfully running Coordinate looks like. Then, when a developer changes Coordinate, he can run the changed app and compare the changed app’s behavior to the correct behavior described below.
templates
Table
1. Initialize One of the two ways Coordinate persists state is by storage in SQLite tables. One of the three SQLite tables, templates
, stores two, and only two, default templates. It also stores any non-negative integer of user-defined templates.
When Coordinate is installed templates
is empty: 0 user-defined templates and 0 default templates. The user-defined templates are inserted when the user uses the app to insert them. The default templates are inserted by the app itself.
When Coordinate runs, the first non-housekeeping thing it does is initiaize templates
with default templates. If one (or both) of the default templates is/are missing, the app inserts it (or them). If one (or both) of the default templates is/are present, the app updates it (or them) in case it has/they have somehow been changed. The user-defined templates are ignored.
2. Version
When Coordinate is installed, persistent storage has no version (the UpdateVersion
value). When queried for a version, persistent storage returns -1
since UpdateVersion
has no value.
Coordinate’s version is hardcoded into the app. When Coordinate is run it compares this hardcoded version to the version in persistent storage. If the hardcoded version is greater than the version in persistent storage (which it will be when first run) then this higher, hardcoded version is written to persistent storage, overwriting the previous, lower version.
As long as the app remains unchanged, subsequent runs will get a version from persistent storage that is the same as the hardcoded version. In this case the hardcoded version is not greater than the version in persistent storage so therefore nothing will be written.
When the Coordinate app is updated but the Coordinate persistent storage is not, the hardcoded version is greater than the verison in persistent storage so therefore the updated version will be written.
3. ChangeLog Dialog Box
Whenever the version is written to persistent storage (see above), the ChangeLog dialog box is displayed. It is also displayed when the user taps a link in the About dialog box.
When Coordinate is run after initial installation the ChangeLog dialog box will be displayed. Subsequent runs will not display the ChangeLog dialog box (unless, of course, the user taps the link in the About dialog box or upgrades the app but not the persistent storage).
4. Background
Coordinate collects data and organizes it into a grid. The grid is not the data: it is, essentially, the container for the data just as the seed tray is the container for the seed.
The data is stored in the entries
table, one datum per record. Each entries
record has a grid
field which references one record in the grids
table.
The grids are stored in the grids
table, one grid per record. Each grids
record has a temp
field which references one record in the templates
table.
The templates are stored in the templates
table, one template per record. But what are templates? Templates are the classes from which grids are instantiated. Templates make possible not just grids of different sizes but also grids of the same size but also grids from the same template (with, of course, distinct titles and timestamps). Templates are one of the two mechanisms Coordinate uses to achieve general-purpose applicability. (The second mechanism is optional fields.)
5. Current Grid
Coordinate works on one (and only one) grid at a time. This grid is designated the current grid. The app can be in one of two states: 1) a current grid has been designated or 2) a current grid has not been designated.
When Coordinate is installed, persistent storage has no current grid (the CurrentGrid
value). When asked if a current grid has been set, persistent storage replies negatively. The app is in the second state: a current grid has not been designated.
6. Template Options Dialog Box
The Template Options dialog box will be displayed. If Coordinate is being run for the first time, the Template Options dialog box will be the second dialog box to be displayed. If not being run for the first time, the Template Options dialog box will be the first dialog box displayed. The dialog box offers two choices: Load Template or New Template. This fork in the testing road offers us two testing paths: 1. Load Existing Template or 2. Create New Template.
?. Load Existing Template
If the user selects Load Template in the Template Options dialog box the Load Template dialog box will be displayed. The Load Template dialog box offers two choices: Seed Tray or DNA Plate. This fork in the testing road offers us two more testing paths: 1.1. Load Seed Tray Template or 1.2. Load DNA Plate Template.
?.1. Load Seed Tray Template
If the user selects Seed Tray in the Load Template dialog box the Seed Tray dialog box will be displayed. The Seed Tray dialog box offers two choices: Cancel or Create. This fork in the testing road offers us two more testing paths: 1.1.1 or 1.1.2.
?.2. Load DNA Plate Template
If the user selects DNA Plate in the Load Template dialog box . . .
?. Create New Template
If the user selects New Template in the Template Options dialog box . . .