Skip to content

Test Definition Structure

bill edited this page Jun 8, 2020 · 1 revision

Test Definition Structure

Test Definition Locations

in WAR file

asbestos/data/TestCollections.

in External Cache at runtime

External_Cache/FhirTestCollections

in sources

asbestos-war/src/main/webapp/data/TestCollections

Structure

A test definition is a directory:

<testCollectionName>/<testName>

where <testCollectionName> is the name of a test collection (our tests are always part of a collection) and where <testName> is a test in that collection. This test directory has a fixed format. In the context of this tool, a test definition is this directory or directory format.

A test definition for a PDB transaction looks like:

Bundle/
    pdb.xml
TestScript.xml
description.md

The test always has a TestScript.xml (or .json). This defines the test. Description.md is the Markdown format for the on-screen documentation. The directory also contains static resource definitions referenced by the TestScript. The format is <ResourceType>/<filename>. In this example pdb.xml is located in the directory Bundle, so it must be a Bundle resource. Since statically defined Bundle can be referenced in the TestScript through a static Fixture (Fixture that references static/non-server content).

Cached Resources

There is a second type of static resource, a static/server resource. This type of resource is static (has a longer lifespan than a test) but resides in a server. This is used for resource that are referenced by the content of a test but must reside in a server and have a valid fullURL. The FHIR standard documentation surrounding the TestScript resource, discussed loading this type of resource during the Setup phase of a TestScript, possibly using the autocreate feature. That approach is not appropriate for this toolkit. Instead, toolkit manages static/server resources. This is the focus of the resource cache.

After Toolkit installation there is a Setup phase where reference Patient resources get loaded into the support server, usually the included copy of HAPI. This creates the following section in the External Cache:

FhirTestLogs/default__default/cache/

default__default refers to the default channel (second default) of the default test session (first default). Channels are connections to servers and test sessions can be used as user accounts although they have other uses as well.

Therefore, a single cache directory holds the cached content for a single FHIR server. The content, organized similar to test definitions:

&lt;ResourcType)/name.json

A cache always contains json, it is only written and read by Toolkit internal code.

Finding cached resources

Loading static resources follows a search-path of locations. In order searched:

Test Definition

Patient/bob.xml in the test definition.

Resource Cache for the current channel

FhirTestLogs/default__xds/cache/Patient/bob.xml - the cache for the current channel - xds.

Resource Cache for the default channel

FhirTestLogs/default__default/cache/Patient/bob.xml - the cache for the default channel.

Clone this wiki locally