Skip to content

The Simulink Model Mutation Testing project provides a framework for generating mutants, and CSV file as an output. It utilizes the MATLAB environment to load the model, apply mutations, and collect outputs.

License

Notifications You must be signed in to change notification settings

haliliceylan/MUT4SLX

Repository files navigation

MUT4SLX

The MUT4SLX tool focuses on performing mutation testing on a model implemented in MATLAB/Simulink. It applies various mutation operators to the model and generates Simulink model mutants.

Description

The MUT4SLX tool provides a structured framework for systematically generating mutants and producing corresponding output files in CSV format. It leverages the MATLAB environment to load Simulink models, apply predefined mutation operators, and record the resulting outputs.

DEMO

DEMO

Features

  • Mutant generation: Apply a set of predefined mutation operators to the Simulink model.
  • CVS output generation: Generate an CSV output summarizing the mutations.
  • HTML Report: Please note that the code used to generate this report is not open-sourced yet. Open Report In Browser

Licensing Information

This repository contains code and assets under different licenses: Make sure to review the specific license for each part of the code. Additionally, check out the example use cases with different licenses:

Getting Started

usage: MUT4SLX.py [-h] --model MODEL [--matlab-gui]

Simulink model mutation tool.

optional arguments:
  -h, --help     show this help message and exit
  --model MODEL  Name of the Simulink model in config file.
  --matlab-gui   Show the MATLAB GUI.

Prerequisites

Installation

  1. Clone the repository: git clone https://github.com/haliliceylan/MUT4SLX.git

Usage

  1. Modify the model_files.json file to specify the models and their configurations.
  2. Run the main script: python MUT4SLX.py --model MODEL
  3. View the generated CSV output: open <model_name>.CSV

Configuration File

The configuration file specifies various settings and parameters for using the MUT4SLX tool. It includes a list of mutant operators and configurations for different Simulink models. Let's break down each part of the configuration file:

Mutant Operators For Simulink

The mutant_operators section lists the available mutant operators. These operators are abbreviated with short names for convenience. Here are the mutant operators included in the configuration file:

{
  "mutant_operators": [
    "ROR",
    "LOR",
    "ASR",
    "MMR",
    "ICR",
    "TOR",
    "MOR",
    "PMR",
    "POR",
    "FIR",
    "FLR",
    "UDO",
    "SCR",
    "STR",
    "CR"
  ],

These operators are used during the mutation process to generate modified versions of the Simulink models for testing.

Mutant Operators For Stateflow

Note: The Stateflow extension has not yet been included in the current version of MUT4SLX. We will release this version soon.

Model Configurations

The configuration file provides settings for different Simulink models. Each model has a unique key, which is used as a reference for specifying the model when running the mutation testing tool. Here are the model configurations included in the file:

The "Heli" section represents a specific configuration for the "Helicopter Control System" Simulink model. The attributes within this section are:

  "Heli": {
    "model": "HelicopterSystem",
    "cd": "matlab_workspace/heli",
    "project": "heli.prj",
    "system": "HelicopterSystem",
    "test": "HeliLoopTest"
  },
  • model: Specifies the main Simulink model to start the mutation process, in this case, "HelicopterSystem."
  • cd: Indicates the relative path of the project directory where the Simulink model is located. It is generally found under the "matlab_workspace" directory with the "heli" subdirectory.
  • project: If the Simulink model depends on a MATLAB project, you can specify the project file using this attribute. In this case, it is "heli.prj."
  • system: Specifies the system name of the main model. It can also accept a full path, allowing the mutation process to start from that path and explore its sub-paths.
  • test: Currently, this attribute is not usable in the current version. However, you can refer to the demo for the full behavior. It represents the test file name for this Simulink model.

Similarly, the configuration sections for other Simulink models like "sf_aircraft," "Aircraft," and "AutotransModel" follow a similar structure, specifying their respective models, directories, systems, and test files if applicable.

Please note that the actual values used in the configuration file, such as model names and paths, are examples provided for demonstration purposes. You should replace them with the appropriate values based on your specific Simulink projects and file structures.

File Structure

  • MUT4SLX.py: This is the main script for performing mutant generation and provides a command-line interface for the tool.
  • model_files.json: This configuration file specifies the models and their details required to run the MUT4SLX tool.
  • matlab_workspace/: This directory contains all MATLAB models and related files.
  • tests/: This directory contains the smoke tests for the tool.
  • HelicopterSystem.html: This is a detailed report on the execution of the Helicopter System mutants. Please note that the code used to generate this report is not open-sourced yet. Open Report In Browser
  • HelicopterSystem_mutants.csv: This CSV file contains information about all the possible mutants generated for the Helicopter System.
  • LICENSE: This file contains the license information for the repository.
  • MutationClasses.py: This file contains the implementation of all mutant operators used by the tool.
  • README.md: This file, which you are currently reading, provides detailed information about the repository.
  • Replication-Package.md: This file contains information about the replication package for the project.
  • config_reader.py: This file includes the implementation of the configuration reader class.
  • .gitignore: This file specifies the files and directories that should be ignored by the Git version control system.

Other supporting files and directories may be present as well.

Example Use Cases

Example use case with Helicopter Control System

(https://github.com/wfpotter/DO178_Case_Study)

Example use case with Aircraft Elevator Control System

(https://gitlab.com/DrishtiYadav/fimtool/-/tree/main/Aircraft_fault_injector/sf_aircraft_model)

Example use case with Automatic Transmission Controller System

(https://gitlab.com/DrishtiYadav/fimtool/-/tree/main/Autotrans_fault_injector/cav_benchmark)

Testing

To run the tests for this project, you can use the following command:

make test # or pytest

Cite This

  1. Ceylan, H. I., Kilincceker, O., Beyazit, M., & Demeyer, S. (2023, September). MUT4SLX: Fast Mutant Generation for Simulink. In 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE) (pp. 2086-2089). IEEE.
  2. Nuyens, S., Ceylan, H. I., Kilincceker, O., Beyazit, M., & Demeyer, S. (2024, March). MUT4SLX: Extensions for Mutation Testing of Stateflow Models. In 2024 IEEE International Conference on Software Analysis, Evolution and Reengineering-Companion (SANER-C) (pp. 215-218). IEEE.

About

The Simulink Model Mutation Testing project provides a framework for generating mutants, and CSV file as an output. It utilizes the MATLAB environment to load the model, apply mutations, and collect outputs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published