SkillAgentSearch skills...

MUT4SLX

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.

Install / Use

/learn @haliliceylan/MUT4SLX

README

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:

  • ROR: Relational Operator Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/relationaloperator.html) to the definition of the relational operators in Matlab/Simulink. The ROR operator changes the current value of the block with other different operators, such as changing "==" with "~=, <, <=, >=, >" operators.
  • LOR: Logical Operator Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/logicaloperator.html) to the definition of the logical operators in Matlab/Simulink. The LOR operator changes the block's current value with other different operators, such as changing "AND" with "OR, NAND, NOR, XOR" operators.
  • ASR: Arithmetic Sign Replacement Please refer (https://nl.mathworks.com/help/matlab/relational-operators.html) to the definition of the relational operators in Matlab/Simulink. The ASR operator changes the block's current value with other different operators, such as changing "==" with "~=, <, <=, >=, >" operators.
  • MMR: Min-Max Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/minmax.html) to the definition of the logical operators in Matlab/Simulink. The MMR operator changes the block's current value with other operators, such as changing "MIN" with "MAX" operators.
  • ICR: If Condition Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/if.html) to the definition of the If condition operators in Matlab/Simulink. The ICR operator changes the block's current value with other operators, such as changing an if condition with "1 == 1 (true), 1 == 0 (false)" conditions.
  • TOR: Trigonometric Operator Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/trigonometricfunction.html) to the definition of the trigonometric operators in Matlab/Simulink. The TOR operator changes the block's current value with other operators, such as changing "sin" operator with "cos, tan, asin, acos , atan, sinh, cosh, tanh, asinh, acosh, atanh, cos + jsin" operators.
  • MOR: Math Operator Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/mathfunction.html) to the definition of the Math operators in Matlab/Simulink. The MOR operator changes the block's current value with other operators, such as changing "exp" operator with "log, 10^u, log10, magnitude^2, square, conj, reciprocal, transpose, hermitian" operators.
  • PMR: Product Multiplication Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/product.html) to the definition of the product multiplication types in Matlab/Simulink. The PMR operator changes the block's current value with other operators, such as changing "Element-wise(.)" type with "Matrix()" type.
  • POR: Product Operator Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/product.html) to the definition of the product block in Matlab/Simulink. The POR operator changes the block's current value with other operators, such as changing "2" input types with "* /, / *, //" types.
  • FIR: For Index Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/foriterator.html) to the definition of the For iterator block in Matlab/Simulink. The FIR operator changes the block's current value with other operators, such as changing "Zero-based" type with "One-based" type.
  • FLR: For Limit Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/foriterator.html) to the definition of the For iterator block in Matlab/Simulink. The FLR operator changes the block's current value with other operators, such as changing the current "x" limit value with "x*2" limit value.
  • UDO: Unit Delay Operation Please refer (https://nl.mathworks.com/help/simulink/slref/unitdelay.html) to the definition of the unit delay block in Matlab/Simulink. The UDO operator changes the block's current value with other operators, such as changing "Columns as channels (frame based)" value with "Elements as channels (sample based)" value.
  • SCR: Switch Criteria Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/switch.html) to the definition of the switch block in Matlab/Simulink. The SCR operator changes the block's current value with other operators, such as changing "u2 >= Threshold" value with "u2 ~= 0" value.
  • STR: Switch Threshold Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/switch.html) to the definition of the switch block in Matlab/Simulink. The STR operator changes the block's current value with other operators, such as changing the current "x" threshold value with "x+10" value.
  • CR: Constant Replacement Please refer (https://nl.mathworks.com/help/simulink/slref/constant.html) to the definition of the constant block in Matlab/Simulink. The CR operator changes the block's current value with other operators, such as changing the current "x" value with "x+1, x+10, x+100, x-1, x-10, x-100" values.
{
  "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.

  • LOM: Logical Operation Mutation Please refer (https://nl.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html) to the definition of the logical operators in Matlab/Stateflow. The LOI operator changes the current value of the logical operator with another different operator, such as changing the "&&" with the "||" operator.
  • ROM: Relational Operation Mutation Please refer (https://nl.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html) to the definition of the relational operators in Matlab/Stateflow. The ROI operator changes the current value of the relational operator with other different operators, such as changing ">" with "<, >=, <=, ==, ~=" operators.
  • BOM: Bitwise Operation Mutation Please refer (https://nl.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html) to the definition of the relational operators in Matlab/Stateflow. The BOI operator changes the current value of the bitwise operator with other different operators, such as changing "&" with "|, ^, ~" operators.
  • MOM: Math Operation Mutation Please refer (https://nl.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html) to the definition of the relational operators in Matlab/Stateflow. The MOI operator changes the current value of the math operator with other different operators, such as changing "+" with "-, *, /" operators.
  • NOM: Non-bitwise Operation Mutation Please refer (https://nl.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html) to the definition of the relational operators in Matlab/Stateflow. The NOI operator changes the current value of the non-bitwise operato
View on GitHub
GitHub Stars6
CategoryDevelopment
Updated5mo ago
Forks1

Languages

HTML

Security Score

87/100

Audited on Oct 8, 2025

No findings