Connecting to the Testing dataset
- 1 Rationale
- 2 /test/testthat/connection_to_datasets/login_details.R
- 3 /test/testthat/connection_to_datasets/local_settings.csv
- 4 Functions provided by /test/testthat/connection_to_datasets/init_all_datasets.R
- 5 Functions provided by /test/testthat/connection_to_datasets/init_local_settings.R
- 6 Installing the DataSHIELD testing framework
Rationale
Some functions that connect to the testing data locally and remotely are provided. These functions initialise some variables of the ds.test_env environment, disconnect some existing connections and connects to the relevant testing table of the virtual machine.
These functions have been written with the following purpose:
The name of the function inform the developer about their purpose
Each function should be easy to use.
Each function complete one task at a time.
Each function promotes some code re-use
Each function enhances the maintenance of the testing framework.
The functions are grouped together based on their purpose, to promote a high cohesion and low coupling.
/test/testthat/connection_to_datasets/login_details.R
This R script sets many of the variables of the ds.test_env environment (see The testing environment ). Any of the values should be edited with care; any changes to the configuration may stop the tests running.
/test/testthat/connection_to_datasets/local_settings.csv
This file contains the IP address used for connecting to a virtual machine, used for the testing. It a comma-separated file made of one line. The default value should be as shown below. This settings depends on the set up in virtual box.
Functions provided by /test/testthat/connection_to_datasets/init_all_datasets.R
This script includes some functions to initialise the testing dataset remotely and locally and connect to a number of server available from the virtual machine. The main function are described below.
Up to version 5.1
The functions connect automatically to the servers using Opal library.
From version 6.0
The functions have been adapted to the needs to DSI and DSLite libraries.
Function name | Description |
---|---|
connect.all.datasets() |
|
connect.dataset.1() |
|
connect.dataset.2() |
|
connect.dataset.3() |
|
init.all.datasets | Helper function - to connect.all.datasets()
|
init.dataset.1 | Helper function - to connect.dataset.1()
|
init.all.datasets | Helper function - to connect.dataset.2()
|
init.all.datasets | Helper function - to connect.dataset.3()
|
Additional reading: |
---|
Functions provided by /test/testthat/connection_to_datasets/init_local_settings.R
This script provides two functions that determine the computer environment used to execute the tests; The latter can be a cloud platform (GitHub and Microsoft Azure) or a local environment (a DataSHIELD develop personally computer with a virtual machine).
Function name | Description |
---|---|
init.ip.address() |
|
init.local.settings() |
|
Installing the DataSHIELD testing framework
To install the testing framework, download the Template Testing R project from repository listed below. Then copy the tests folder in an empty R project or existing DataSHIELD R project. https://github.com/patRyserWelch8/ds.TestingTemplateRProject/tree/master/tests/testthat
Â
Â
Â
DataSHIELD Wiki by DataSHIELD is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at http://www.datashield.ac.uk/wiki