TL-CTD is an automated testing tool for reactive systems that combines formal verification with combinatorial testing. The tool automatically generates optimized test suites by integrating NuSMV model checking with pairwise coverage algorithms.
Testing critical software systems faces three fundamental challenges:
- State Space Explosion: The number of possible test sequences is infinite or extremely large
- Insufficient Coverage: Manual testing often misses edge cases and rare behavioral combinations
- Scenario Generation Complexity: Creating test sequences that reach specific system states is difficult and error-prone
TL-CTD addresses these challenges through:
- Formal Models: Systematic state space exploration using NuSMV
- Combinatorial Algorithms: Pairwise coverage to reduce test suite size by 70-90%
- Automated Witness Extraction: Counter-example generation via model checking
- Guaranteed Coverage: 100% coverage of all feasible test targets
The tool implements a five-stage pipeline:
- Parser: Load and parse NuSMV model and temporal logic properties
- Coverage Target Generation: Create pairwise combinations of property valuations
- Witness Extraction: Extract execution traces from NuSMV for each target
- Optimization: Apply greedy set cover to minimize test suite size
- Reporting: Generate JSON output with coverage statistics
- Python 3.9 or higher
- NuSMV 2.7.1 or higher (available from http://nusmv.fbk.eu)
- pip (Python package manager)
# Clone the repository
git clone https://github.com/edenbar23/Introduction-to-Formal-Verification-Methods.git
cd Introduction-to-Formal-Verification-Methods
# Install dependencies
pip install -r requirements.txt
# Install TL-CTD
pip install -e .
# Verify installation
tlctd --helpGenerate a test suite using the provided e-commerce example:
tlctd --model examples/ecommerce/store.smv \
--properties examples/ecommerce/properties.yaml \
--output test_suite.json \
--coverage-reportThe tool will:
- Parse the shopping cart model and 7 properties
- Generate coverage targets (typically 80-100 targets)
- Extract execution traces from NuSMV
- Optimize the test suite (typically 20-30 tests)
- Save results to
test_suite.json
Basic syntax:
tlctd --model MODEL.smv --properties PROPS.yaml --output OUTPUT.jsonCommon options:
# Display detailed progress
tlctd -m model.smv -p props.yaml -o out.json --verbose
# Show coverage statistics
tlctd -m model.smv -p props.yaml -o out.json --coverage-report
# Set timeout for NuSMV calls (in seconds)
tlctd -m model.smv -p props.yaml -o out.json --timeout 120
# Skip optimization (keep all witnesses)
tlctd -m model.smv -p props.yaml -o out.json --no-optimize
# Limit number of targets (for testing)
tlctd -m model.smv -p props.yaml -o out.json --max-targets 50Running tlctd without arguments launches an interactive wizard that guides you through the process with menu-based selections.
Models should include:
- State variables representing the system
- An action/step variable for test sequences
- A program counter (pc) for bounded model checking
- Transition logic using ASSIGN statements
Example:
MODULE main
VAR
state: {IDLE, LOGGED_IN, CHECKOUT, ERROR};
cart_items: 0..5;
step: {None, Login, AddItem, RemoveItem, Pay, Logout};
pc: 0..10;
ASSIGN
init(state) := IDLE;
init(cart_items) := 0;
init(step) := None;
init(pc) := 0;
next(pc) := (pc < 10) ? pc + 1 : pc;
next(state) := case
state = IDLE & step = Login : LOGGED_IN;
state = LOGGED_IN & step = Pay & cart_items > 0 : CHECKOUT;
state = LOGGED_IN & step = Pay & cart_items = 0 : ERROR;
TRUE : state;
esac;
Properties are specified in YAML with two sections:
properties:
- name: "login_performed"
type: "LTL"
formula: "F (state = LOGGED_IN)"
description: "The test sequence includes a successful login."
- name: "checkout_reached"
type: "LTL"
formula: "F (state = CHECKOUT)"
description: "The test reaches the checkout phase."
- name: "security_violation"
type: "CTL"
formula: "EF (state = IDLE & step = Pay)"
description: "Tests unauthorized payment attempt."
configuration:
max_trace_length: 10
strategy: "pairwise"
timeout: 60The tool generates a JSON file containing:
{
"metadata": {
"generated_at": "2026-02-05T22:20:33",
"model_file": "store.smv",
"properties_file": "properties.yaml",
"tool": "TL-CTD",
"version": "0.1.0"
}
}{
"coverage": {
"total_targets": 93,
"covered_targets": 23,
"infeasible_targets": 70,
"uncovered_targets": 0,
"coverage_percentage": 100.0,
"infeasible_target_ids": ["target_1", "target_2", ...]
}
}{
"test_suite": {
"total_tests": 23,
"test_cases": [
{
"test_id": "TC-001",
"target_id": "prop_login_performed",
"description": "Test property: login functionality",
"feasible": true,
"steps": [
{
"step_number": 1,
"state": {
"state": "IDLE",
"cart_items": 0,
"step": "None",
"pc": 0
}
},
{
"step_number": 2,
"state": {
"state": "LOGGED_IN",
"step": "Login",
"pc": 1
}
}
]
}
]
}
}Two complete examples are provided:
Location: examples/ecommerce/
Demonstrates:
- Web application state modeling
- Security properties (authentication, authorization)
- Business logic validation
- Error state handling
Location: examples/elevator/
Demonstrates:
- Embedded system modeling
- Safety-critical properties
- Multi-floor state management
- Real-time constraints
Both examples include:
- Complete NuSMV models (.smv files)
- Property specifications (.yaml files)
- Documentation explaining the system
The tool satisfies the following criteria from the project proposal:
- Successfully loads models and properties without errors
- Produces test suites with 100% coverage of feasible property pairs
- Identifies and reports infeasible targets
- Completes execution in reasonable time (seconds to minutes for medium models)
- Generates machine-readable JSON and human-readable reports
TL-CTD implements the methodology described in the project proposal:
- Parsing: Load NuSMV model and YAML properties
- Target Generation: Create pairwise combinations of property valuations
- Witness Extraction: For each target, construct a negated formula and use NuSMV to find counter-examples
- Greedy Optimization: Use set cover algorithm to minimize test suite while maintaining coverage
- Reporting: Export results in JSON format with coverage statistics
- Language: Python 3.9+
- Model Checker: NuSMV (subprocess-based execution)
- Algorithm: Greedy set cover for test suite optimization
- Coverage Strategy: Pairwise combinatorial testing
- Model Checking Mode: Bounded Model Checking (BMC) for shorter traces
- README.md (this file): Project overview and quick start
- USER_GUIDE.md: Comprehensive usage guide with examples
- examples/: Complete working examples with documentation
MIT License - See LICENSE file for details
Eden Bar Ben-Gurion University Introduction to Formal Verification Methods Course