Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Getting Started Creating a Test Kit

This page shows you how to create a Test Kit from scratch. We recommend using the Inferno Template repository as a starting point, since it includes everything you’ll need to get started.

We also have a tutorial designed to walk a user through writing a basic set of tests for servers of the US Core Implementation Guide v3.1.1. Click here for the US Core Test Kit tutorial.

Tests can be developed either with a local Ruby installation or by using Docker. We recommended installing Ruby locally for development because:

  • When the tests change, it is much faster to restart native Ruby processes than to stop/rebuild/start Docker images.
  • Ruby lets you set breakpoints and access an interactive debugger inside of running tests, which makes test development easier.
  • The Inferno Command Line Interface can be used, which includes additional useful functionality for developers, such as an interactive console. See Inferno CLI for more information.

Development with Ruby

Windows Instructions

Windows developers will need to use WSL in order to interact with Inferno. It is recommended that you also follow the steps for installing node.js. Once you have WSL (and node.js) set up:

  1. Install VS Code and the WSL Extension.
  2. Install Ubuntu from the Windows Store.
  3. Open Command Prompt and run ubuntu.
    1. You will have to setup a user and password for this linux subsytem.
    2. The password will be used for sudo commands later, so remember these credentials!
  4. Install Docker Desktop for Windows.
    1. Follow the steps from Docker to ensure it plays nicely with WSL, see here.
    2. From the Docker settings, Open Resources > WSL Integration, and make sure Ubuntu is selected. Then, hit “Apply and Restart”.
  5. From VS Code, press Ctrl + Shift + P to open the command palette, and type “WSL”. Select “Connect to WSL in new Window using distro…” and select Ubuntu.
  6. Open a terminal in the new WSL window and try to ping google.com.
  7. If you cannot ping google.com, you may not be able to connect to the internet from within the WSL instance. The steps at this stack overflow article should resolve the issue. If it does not, open cmd and run nslookup. Copy the Default Address, then in your wsl instance type sudo nano /etc/resolv.conf. Add the default address as another nameserver.
  8. Continue from step 2 in Set Up Environment.

NOTE: If, when running Inferno within WSL, the tests begin to stall and the console repeatedly prints WARN: Your Redis network connection is performing extremely poorly., WSL may be having networking issues. To resolve this, you can follow the steps in this WSL Slow Network Issue thread. You can make a .wslconfig file from your %USERDATA% directory if it does not already exist, and you will need to restart WSL (usually through wsl --shutdown in Windows Powershell) before the changes take effect.

Set Up Environment

  1. Install Docker.
  2. Install Ruby. It is highly recommended that you install Ruby via a Ruby version manager.
  3. Run gem install inferno_core to install inferno.
  4. Run gem install foreman to install foreman, which will be used to run the Inferno web and worker processes.
  5. Run gem install rerun to install rerun, which will be used to enable watch functionality to reload Inferno when a test has been updated.

Set Up a New Test Kit

  1. Clone the Inferno Template repository. You can either clone this repository directly, or click the green “Use this template” button to create your own repository based on this one.
  2. Run bundle install to install dependencies.
  3. Run bundle exec inferno migrate to set up the database.

Run Your Test Kit

  1. Run bundle exec inferno services start to start the background services. By default, these include nginx, Redis, the FHIR validator service, and the FHIR validator UI. You can check to make sure they’re running by running docker container ls in the command line, or checking the “Container” tab in Docker Desktop.
  2. Run inferno start --watch to start Inferno and have it reload any time a file changes. Remove the watch flag if you would prefer to manually restart Inferno.
  3. Navigate to http://localhost:4567 to access Inferno. You should see two test groups on the side of the page: “Capability Statement” and “Patient Tests”. To access the FHIR resource validator, navigate to http://localhost/validator.
  4. When you are done, run bundle exec inferno services stop to stop the background services.

Development with Docker Only

Set Up Environment

  1. Install Docker.

Set Up a New Test Kit

  1. Clone the Inferno Template repository. You can either clone this repository directly, or click the green “Use this template” button to create your own repository based on this one.
  2. Run ./setup.sh in the template repository to retrieve the necessary Docker images and create a database.

Run Your Test Kit

  1. Run the ./run.sh script to start Inferno.
    • Navigate to http://localhost to access Inferno and run test suites.
    • Navigate to http://localhost/validator to access a standalone validator that can be used to validate individual FHIR resources.

Next Steps

Now that Inferno is running, you can:

  • Go to Template Layout for how to update the template for your use case
  • Go to Inferno CLI for more information about the inferno commands available,
  • Go to Debugging for more information about debugging in Inferno,
  • Or just jump to Writing Tests.