Commit 4898bfd
Expand test coverage from 45% to 51% across 6 phases (242→662 tests, +420 tests)
This commit concludes a comprehensive test coverage expansion initiative executed
across 6 phases by multiple agents working in parallel. The project now achieves
51% code coverage (8,824/17,070 instructions) with 662 total tests (628 passing,
34 skipped).
Coverage by package:
- objects.tracks/: 85% (excellent) - safety-critical track operations
- xml/: 85% (excellent) - XML parsing and validation
- util/: 75% (good) - utility classes and data structures
- objects.cells/: 72% (good) - grid-based spatial representation
- context/: 70% (good) - railway network context management
- objects.paths/: 52% (medium) - route management
- sim/: 33% (limited) - simulation engine (jDisco framework restrictions)
- Main: 22% (entry point) - CLI (some tests disabled due to System.exit)
- gui/: 0% (deferred) - GUI testing deferred per QA assessment
Phase 1: Safety-critical components (51 tests)
- TrainPhysicsTest, SimpleTrackStateTest, RailSwitchTest, RailSemaphoreTest
- Validates railway safety properties SI-1, SI-3, SI-5
Phase 2: Simulation engine core (50 tests)
- TrainStateTransitionTest, TrainPathInteractionTest, InOutWorkerPathHandlingTest
- Validates safety properties SI-1, SI-3, SI-4, SI-6
Phase 3: Path and track integration (54 tests)
- AbstractPathTest, SimpleTrackEnterLeaveTest, PathTrackIntegrationTest
- TrackTestMocks utility infrastructure created
Phase 4: Main entry points and cell edge cases (92 tests)
- MainArgumentParsingTest (28 tests disabled - System.exit issue)
- ExampleLoadingTest, ContextInitializationTest, NodeCellTest
Phase 5: Generator and advanced simulations (76 tests)
- GeneratorTest, ShuntingLoopOperationalTest, TimetableTest, TimeTest
Phase 6: Exception handling and edge cases (156 tests)
- SimulationExceptionTest (51 tests), PathValidationTest (36 tests)
- DeadlockDetectionTest, InvalidNetworkTest, RaceConditionTest
RailSwitch.kt enhancements:
- Added lock/unlock mechanism for safety property SI-5 (prevent configuration
changes during train movement)
- Enhanced PropertyChangeSupport for observer pattern migration
- Added convenience methods: isNormal(), isReverse(), getConf()
Source files updated for improved testability:
- DefaultContext.kt, Train.kt, Generator.kt, InOutWorker.kt, SimpleTrack.kt
- Point.kt, RailwayNetGridCanvas.kt
build.gradle.kts:
- Increased test JVM heap: -Xmx1g -Xms512m for large test suite
- Added forkEvery=100 to prevent test executor crashes
- Re-enabled parallel test execution (8 cores: 2x speedup)
- Migrated from AssertJ to AssertK 0.28.1 (Kotlin-native assertions)
- All 662 tests use AssertK with fluent Kotlin syntax
- Custom AssertKExtensions for railway domain assertions
Test files created by parallel agent coordination:
- kotlin-junior-dev: 15+ test files
- kotlin-railway-dev: 7+ test files (domain expertise)
- java-junior-developer: 10+ test files
- Total: 22 new test files + 24 enhanced existing files
CLAUDE.md:
- Updated Testing section with comprehensive phase breakdown
- Added coverage statistics and package-level metrics
- Documented 36 test classes across all phases
README.md:
- Updated test statistics (242→662 tests)
- Added coverage achievements by package
- Summarized 6-phase expansion initiative
MainArgumentParsingTest (28 tests disabled):
- Main.createContext() calls System.exit(1), killing test JVM
- Tests preserved for future re-enablement after Main refactoring
- 662 tests total (628 passing, 34 skipped, 0 failing)
- 94.9% pass rate
- 51% instruction coverage (+6pp from 45% baseline)
- Zero build failures after bugfix phase
- Parallel execution enabled (8-10s vs 18-20s serial)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 2bc2141 commit 4898bfd
52 files changed
Lines changed: 13329 additions & 710 deletions
File tree
- src
- main/kotlin/cz/vutbr/fit/interlockSim
- context
- gui
- objects
- cells
- tracks
- sim
- util
- test/kotlin/cz/vutbr/fit/interlockSim
- context
- objects
- cells
- paths
- tracks
- sim
- testutil
- util
- xml
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
384 | 386 | | |
385 | 387 | | |
386 | 388 | | |
| |||
476 | 478 | | |
477 | 479 | | |
478 | 480 | | |
479 | | - | |
| 481 | + | |
480 | 482 | | |
481 | 483 | | |
482 | 484 | | |
483 | 485 | | |
484 | | - | |
| 486 | + | |
485 | 487 | | |
486 | 488 | | |
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
491 | 493 | | |
492 | | - | |
493 | | - | |
494 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
495 | 497 | | |
496 | 498 | | |
497 | 499 | | |
498 | | - | |
| 500 | + | |
499 | 501 | | |
500 | 502 | | |
501 | 503 | | |
502 | 504 | | |
503 | 505 | | |
504 | 506 | | |
505 | 507 | | |
506 | | - | |
| 508 | + | |
507 | 509 | | |
508 | 510 | | |
509 | | - | |
| 511 | + | |
510 | 512 | | |
511 | 513 | | |
512 | 514 | | |
513 | | - | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
514 | 547 | | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
| 548 | + | |
521 | 549 | | |
522 | | - | |
523 | | - | |
524 | | - | |
| 550 | + | |
525 | 551 | | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
| 552 | + | |
530 | 553 | | |
531 | | - | |
532 | | - | |
| 554 | + | |
533 | 555 | | |
534 | 556 | | |
535 | | - | |
| 557 | + | |
536 | 558 | | |
537 | 559 | | |
538 | 560 | | |
| 561 | + | |
| 562 | + | |
539 | 563 | | |
540 | 564 | | |
541 | 565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
427 | 440 | | |
428 | 441 | | |
429 | 442 | | |
| |||
0 commit comments