Because redcapcustodian works with database tables for both input and output data, the development and testing process will require that we can repeatably instantiate tables from code and populate them with test data. To that end, we will need functions and recipes that simplify that task. These tools should be as reduce the code required to instantiate a novel testing environment and be quick to run so tests can be run quickly and often.
Here is a non-modular approach for creating an in-memory data source using DBI, SQLite, a schema file, a data file, tidyverse. The function create_test_table() reads the schema file to create the table then reads the data file to populate it.
Codify create_test_table() as a function in the library
SQL and CSV files for two REDCap tables. Do this for redcap_user_information and redcap_projects. A few records of data in each is fine. Exporting the test users built by redcap_custodian might well be perfect for redcap_user_information.
Create a test that creates one of those tables with create_test_table() to verify its functionality
Create an example script that uses these files to instantiate the two tables based on a vector of tables names.
Because
redcapcustodian
works with database tables for both input and output data, the development and testing process will require that we can repeatably instantiate tables from code and populate them with test data. To that end, we will need functions and recipes that simplify that task. These tools should be as reduce the code required to instantiate a novel testing environment and be quick to run so tests can be run quickly and often.Here is a non-modular approach for creating an in-memory data source using DBI, SQLite, a schema file, a data file, tidyverse. The function
create_test_table()
reads the schema file to create the table then reads the data file to populate it.This issue should create these deliverables:
create_test_table()
as a function in the libraryredcap_user_information
andredcap_projects
. A few records of data in each is fine. Exporting the test users built by redcap_custodian might well be perfect for redcap_user_information.