Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Current »

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.

Function name

Description

connect.all.datasets()

  • Disconnect to any Opal servers currently connected.

  • The three local datasets referred as ds.test_env$local.values.[1-3] and ds.test_env$local.values are initialised.

  • The three tables of the TESTING dataset are made available.

  • This function is useful to complete some tests on split and combined datasets.

  • No value is returned.

connect.dataset.1()

  • Disconnect to any Opal servers currently connected.

  • The local dataset referred as ds.test_env$local.values.1 is initialised

  • The table TESTING. DATASET1 is made available

  • This function is useful to complete some tests one server.

  • No value is returned

connect.dataset.2()

  • Disconnect to any Opal servers currently connected.

  • The local dataset referred as ds.test_env$local.values.2 is initialised

  • The table TESTING. DATASET2 is made available

  • This function is useful to complete some tests one server.

  • No value is returned

connect.dataset.3()

  • Disconnect to any Opal servers currently connected.

  • The local dataset referred as ds.test_env$local.values.3 is initialised

  • The table TESTING. DATASET3 is made available

  • This function is useful to complete some tests one server.

  • No value is returned

init.all.datasets

Helper function - to connect.all.datasets()

  • Initialise the local values, information to connect to the three servers, and all the columns provided by the TESTING datasets.

init.dataset.1

Helper function - to connect.dataset.1()

  • Initialise the local values, information to connect to the server, and all the columns provided by the TESTING.DATASET1.

init.all.datasets

Helper function - to connect.dataset.2()

  • Initialise the local values, information to connect to the server, and all the columns provided by the TESTING.DATASET2.

init.all.datasets

Helper function - to connect.dataset.3()

  • Initialise the local values, information to connect to the server, and all the columns provided by the TESTING.DATASET3.

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()

  • Initialise the local settings from the execution path

  • Identifies the specified IP address of the virtual machine or the local host (that is 127.0.0.1)

  • Returns the IP address

init.local.settings()

  • build the current path to the local_settings.csv file

  • return the absolute path of local_settings.csv file

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

  • No labels