Back to all updates

over 10 years ago

Sample Test Script: Scenario 001 Description

Please view this document in entirety in PDF format at

Sample Test Script: Scenario 001 Description

For the convenience of contestants, the configured testing framework provides an example of a fully implemented Use Case Scenario. This is Scenario 001 from the document of “Use Cases”. This document describes details of the script that implements this first scenario, with the goal of facilitating the work of contestants when setting up the tests for the subsequent seven Use Case scenarios.


Please refer to the instructions in document TCMS – Instruction on Use of Testing Environment to set up and modify the testing environment.

Script Components

The sample test script that implements the Use Case Scenario 001 consists of two major components:

  • Python Scripts and Sub-modules
  • Configuration files in JSON format

They are described in detail below.

The sub-module mechanism, used in the Python and JSON files, is convenient in that a submodule can be reused by calling it from the testing scripts implementing other use cases.

Python script and sub-modules:

  • This is the driving script of testing Scenario 001. This script defines the overall workflow of multiple sub-tasks that the Use Case tests. The detailed implementation of individual tasks is located in sub-module Python files.
  • Sub-modules: These are reusable Python modules to fulfill a specific setup/action. The name of each sub-module script is self-explanatory, for example:
  1. is a Python sub-module that set up doctors in a VistA instance.
  2. is a Python sub-module that set up clinics in a VistA instance.
  3. is a sub-module that verifies the patient appointment information.

            Currently, the testing infrastructure has about 20 sub-modules to implement actions required by Scenario 001 and others.

Configuration files in JSON format:

These files contain configuration data that is used by the Python sub-modules in order to set up the testing environment. For example, the exact list of holidays to be respected during the scheduling process.

  • Configuration file Scenario001.json: A custom test configuration of VistA based on scenario 001. This configuration file specifies the overall test configuration blocks; however, for each individual block, the details are stored in the specified sub-configuration file, also in JSON format.
  • Individual sub-configuration files: specify detailed configuration information, for example:

            ServiceSection.json will specify four types of service sections.

In the CMake Process, as mentioned in the document TCMS – Instruction on Use of Testing Environment, both Python scripts and configuration files will be automatically configured based on input information that is specific to a given Virtual Machine, for example, the name of the states where they are hypothetically located (California, Georgia, Alabama).


In this test scenario, the Python script reads the input based on the configuration file and performs the following actions in order:

  • Startup taskman.
  • Set up service section.
  • Set up appointment notification letters.
  • Set up holidays.
  • Create a system manager.
  • Add test patients.
  • Set up Institutions.
  • Set up divisions.
  • Add doctors.
  • Add clinics.
  • Assign notification letters.
  • Make an appointment for test patient.
  • Verify the appointment that just made.

Please notice that the last two actions highlighted in bold are beyond the scope of scenario 001, but are provided for the contestant’s convenience as an example of how to verify actions for subsequent tests.

Configuration File in Details:

The detail of the is as following:





    "Common Doctors":"CommonDoctors.json",

    "Unique Doctors":"UniqueDoctors.json"




    "Common Patients":"CommonPatients.json",

    "Unique Patients":"UniquePatients.json"



  "Notification Letters":"NotificationLetters.json",

  "Service Sections":"ServiceSections.json"


As you probably noticed, the format is very easy to read (see more details at The file above  specified 8 sections: Institutions, Divisions, Doctors, Clinics, Patients, Holidays, Notification Letter, and Service sections. The value of the each of the section is the name of the individual sub-configuration file.

For instance, the institution configuration file “” looks like the following:





      "Station Number":"401",

      "Type Code":"MC",



      "Facility Type":"HCS",

      "Street":"1 Main ST",



      "Zip Code":"14114"




      "Station Number":"401MC",

      "Type Code":"MC",



      "Facility Type":"VAMC",

      "Street":"1 Main ST",



      "Zip Code":"14114"




Notice that ${VISTA_STATE} symbol in the file above is a variable that is specified during the CMake configuration process, as described in detail in the document TCMS – Instruction on Use of Testing Environment.

Contestants are encouraged to add more Python sub-modules, and expand the configuration file as needed.