What Goes In Must Come Out: Functional Testing for Complex Simulation Models
PURPOSE: High-quality computer code is critical in complex simulation models. While previous work has highlighted the value of unit testing individual components of model code, best practices for performing and reporting comprehensive simulation model tests remain underdeveloped. Adapting a functional testing paradigm from software engineering, we propose a systematic process for verifying that a model's written description, including input parameters and structural assumptions, is accurately reflected in its code. METHODS: In standard software testing, programmers verify that code produces expected outputs given a set of inputs. However, researchers often build simulation models precisely because complex nonlinear functions lack closed-form solutions, making it difficult to calculate expected outputs (eg, health outcomes following an intervention) and thus to assess whether code performs as intended. To address this challenge, we describe how to define intermediate outputs that can be used to verify whether each input behaves as expected within the system dynamics defined by the model. RESULTS: We provide a worked example using an agent-based infectious disease transmission model. CONCLUSIONS: We propose and demonstrate a flexible, transparent framework for rigorously testing complex simulation models. Functional testing can reduce coding errors and facilitate uniform standards for model code validation.
Authors
- Meagan C. Fitzpatrick (ORCID: https://orcid.org/0000-0002-5248-2668)
- John Giardina (ORCID: https://orcid.org/0000-0002-6618-1671)
- Andrea L. Ciaranello (ORCID: https://orcid.org/0000-0002-4268-3263)
- Alyssa Bilinski (ORCID: https://orcid.org/0000-0001-9108-6660)
- Luke Massa
Institutions
- University of Maryland, Baltimore (US)
- Harvard University (US)
- Massachusetts General Hospital (US)
- Department of Health Services (NP)
Publication Details
- Journal
- Medical Decision Making
- Published
- 2026-11-30
- DOI
- https://doi.org/10.1177/0272989x261488066
- Primary Topic
- Simulation Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00