From 695adc1f6bfb0a0eeef4dd6c035475ea2826871f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Jun 2025 20:10:38 +0300 Subject: Complete GUI decoupling implementation for headless testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implement MessageHandler pattern to decouple message sending from visualization - Add HeadlessLoader to load simulations without GUI components - Create HeadlessProtocolRunner for clean protocol test execution - Update VSInternalProcess to use MessageHandler for message routing - Add null checks in VSSimulator for headless mode compatibility - Update VSSimulatorVisualization paint() to check for headless mode - Remove obsolete test scripts and documentation - Update test-protocols.sh to remove GUI error suppression options - Consolidate testing documentation in docs/testing-guide.md All protocol tests now run cleanly in headless mode without GUI errors, enabling proper CI/CD integration and automated testing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docs/testing-framework-usage.md | 88 ----------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 docs/testing-framework-usage.md (limited to 'docs/testing-framework-usage.md') diff --git a/docs/testing-framework-usage.md b/docs/testing-framework-usage.md deleted file mode 100644 index 9ea907d..0000000 --- a/docs/testing-framework-usage.md +++ /dev/null @@ -1,88 +0,0 @@ -# DS-Sim Testing Framework Usage - -## Overview - -The DS-Sim testing framework provides headless testing capabilities for protocol simulations without requiring GUI components. - -## Quick Start - -Run all protocol tests: -```bash -./run-tests.sh -``` - -## Test Runners - -### 1. Standard Test Runner (with logs) -Shows test results with protocol logs: -```bash -java -cp target/classes testing.ProtocolTestRunnerWithLogs -``` - -### 2. Quiet Test Runner -Filters out GUI-related errors for cleaner output: -```bash -java -cp target/classes testing.QuietProtocolTestRunner -# or -./run-tests.sh -q -``` - -### 3. Verbose Test Runner -Shows detailed logs for debugging: -```bash -java -cp target/classes testing.ProtocolTestRunner -v -# or -./run-tests.sh -v -``` - -## Running Specific Tests - -To run tests programmatically: -```java -HeadlessSimulationRunner runner = new HeadlessSimulationRunner(); -runner.setPrintLogs(true); // Enable log output - -SimulationResult result = runner.runSimulation( - "saved-simulations/ping-pong.dat", - 2000 // Duration in ms -); - -// Verify results -ProtocolVerifier verifier = new ProtocolVerifier() - .expectLog("Ping-Pong.*activated") - .expectLog("Message sent") - .expectNoLog("ERROR"); - -VerificationResult verification = verifier.verify(result.getAllLogs()); -System.out.println("Test passed: " + verification.passed()); -``` - -## Test Coverage - -The framework tests all non-Raft protocols: -- Ping-Pong -- Ping-Pong Sturm -- Broadcast -- Basic Multicast -- Reliable Multicast -- Berkeley Time Sync -- Internal Time Sync -- External vs Internal Sync -- One-Phase Commit -- Two-Phase Commit -- Slow Connection - -## Known Limitations - -- Some GUI-related errors may appear due to DS-Sim's tight coupling with visual components -- These errors don't affect test functionality -- Use quiet mode (`-q`) to filter them out - -## Maven Integration - -Run tests as part of the build: -```bash -mvn test -``` - -Note: Ensure Maven Surefire plugin is properly configured to discover test classes. \ No newline at end of file -- cgit v1.2.3