To learn how to use the Inferno Framework and Inferno Core to develop your own FHIR API tests, visit Inferno Framework Documentation: Getting Started for Inferno Test Writers. If you’d like to get started right away, clone the Inferno Test Kit Template repository which provides a pre-configured project with Inferno Core that you can use to start creating tests.
About Inferno Core
Inferno Core is a Ruby library used to create Ruby-based test applications (called Inferno Test Kits) and provides features useful for writing and executing FHIR API tests:
- Inferno DSL: A domain specific language for authoring FHIR API tests that includes a FHIR client, native Ruby classes for FHIR, and FHIR instance validators
- API, Web and CLI Interfaces: Multiple interfaces for executing tests and retrieving results
- Test Reuse: Methods for reusing tests within a project or from other projects
Because tests are written as Ruby scripts, test writers are able to leverage a fully-featured programming language and a rich ecosystem of open source third-party libraries to write their tests if needed. This makes Inferno well-suited for testing data exchanges that:
- include the use of additional standards beyond FHIR,
- have large specifications that could benefit from Ruby’s meta-programming capabilities to ease maintenance burden,
- or require complex logic to thoroughly validate API responses.
Inferno Core provides common utilities for FHIR-based testing, but tests are not limited to what is provided by Inferno Core. Inferno Core’s goal is to expand on the set of common utilities it provides for the benefit of the community.
Contributing to Inferno Core
Inferno Core contains functionality that should be broadly useful for testing any FHIR-based data exchange, and the team welcomes contributions. Developers interested in contributing to the Inferno Core gem must have Ruby 3.1+ and Node.js and NPM installed.
If you are interested in developing tests using Inferno Core, use the Inferno Template Repository. These instructions are for developers working on Inferno Core itself.
Running Inferno Core for Development Purposes
``` # Install dependencies npm install bundle install gem install foreman
Set up database
Start Inferno background services (validator, redis, nginx)
bin/inferno services start # Start web server, worker, and webpack bin/inferno start
When you’re done, stop the background services
bin/inferno services stop ```
Inferno Core can then be accessed by navigating to http://localhost:4567/inferno
To only run the server (JSON API with no UI):
bundle exec puma
Running tests via JSON API
With the server running, first retrieve a list of available test suites:
See the details of a test suite:
Then create a test session for the suite you want to use:
Tests within a suite are organized in groups. Create a test run to run an entire
suite, a group, or an individual test. Only one of
test_id should be provided.
"value": "input1 value"
"value": "input2 value"
Then you can view the results of the test run:
Development in a Ruby console
To get to an interactive console, run
bundle exec bin/inferno console
Inferno Core allows you to add your own customizable banner. It loads the banner
config/banner.html.erb file and renders it above the application. The
size and appearance of the banner can be controlled by using the inline style
Inferno documentation source code is located in the
docs/ directory. This
documentation is rendered using Jekyll, which creates a site that can be built
and served with:
bundle exec jekyll serve
By default the site will be served at
Copyright 2023 The MITRE Corporation
Licensed under the Apache License, Version 2.0 (the “License”); you may not use
this file except in compliance with the License. You may obtain a copy of the
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
HL7, FHIR and the FHIR [FLAME DESIGN] are the registered trademarks of Health Level Seven International and their use does not constitute endorsement by HL7.