- Add Catch2 test framework with MockIO and TimeSimulator utilities - Implement 10 TI for SchedulerModule (task lifecycle, hyperfocus, breaks) - Implement 10 TI for NotificationModule (queue, priority, silent mode) - Fix SchedulerModule: update m_lastActivityTime in process() - Add AISSIA_TEST_BUILD guards to avoid symbol conflicts - All 20 tests passing (69 assertions total) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
98 lines
3.1 KiB
CMake
98 lines
3.1 KiB
CMake
# ============================================================================
|
|
# AISSIA Integration Tests
|
|
# ============================================================================
|
|
|
|
# Fetch Catch2
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
Catch2
|
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
|
GIT_TAG v3.4.0
|
|
)
|
|
FetchContent_MakeAvailable(Catch2)
|
|
|
|
# ============================================================================
|
|
# Test executable
|
|
# ============================================================================
|
|
add_executable(aissia_tests
|
|
main.cpp
|
|
|
|
# Mocks
|
|
mocks/MockIO.cpp
|
|
|
|
# Module sources (needed for testing)
|
|
${CMAKE_SOURCE_DIR}/src/modules/SchedulerModule.cpp
|
|
${CMAKE_SOURCE_DIR}/src/modules/NotificationModule.cpp
|
|
${CMAKE_SOURCE_DIR}/src/modules/MonitoringModule.cpp
|
|
${CMAKE_SOURCE_DIR}/src/modules/AIModule.cpp
|
|
${CMAKE_SOURCE_DIR}/src/modules/VoiceModule.cpp
|
|
${CMAKE_SOURCE_DIR}/src/modules/StorageModule.cpp
|
|
|
|
# Module tests (60 TI)
|
|
modules/SchedulerModuleTests.cpp
|
|
modules/NotificationModuleTests.cpp
|
|
modules/MonitoringModuleTests.cpp
|
|
modules/AIModuleTests.cpp
|
|
modules/VoiceModuleTests.cpp
|
|
modules/StorageModuleTests.cpp
|
|
|
|
# MCP tests (50 TI)
|
|
mcp/MCPTypesTests.cpp
|
|
mcp/StdioTransportTests.cpp
|
|
mcp/MCPClientTests.cpp
|
|
)
|
|
|
|
target_link_libraries(aissia_tests PRIVATE
|
|
Catch2::Catch2WithMain
|
|
GroveEngine::impl
|
|
AissiaTools
|
|
spdlog::spdlog
|
|
)
|
|
|
|
# Disable module factory functions during testing
|
|
target_compile_definitions(aissia_tests PRIVATE AISSIA_TEST_BUILD)
|
|
|
|
target_include_directories(aissia_tests PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
|
|
# ============================================================================
|
|
# Copy test fixtures to build directory
|
|
# ============================================================================
|
|
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fixtures/
|
|
DESTINATION ${CMAKE_BINARY_DIR}/tests/fixtures)
|
|
|
|
# ============================================================================
|
|
# CTest integration
|
|
# ============================================================================
|
|
include(CTest)
|
|
# Note: catch_discover_tests requires running the exe at build time
|
|
# which can fail due to missing DLLs. Use manual test registration instead.
|
|
add_test(NAME aissia_tests COMMAND aissia_tests)
|
|
|
|
# ============================================================================
|
|
# Custom targets
|
|
# ============================================================================
|
|
|
|
# Run all tests
|
|
add_custom_target(test_all
|
|
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
|
|
DEPENDS aissia_tests
|
|
COMMENT "Running all integration tests"
|
|
)
|
|
|
|
# Run module tests only
|
|
add_custom_target(test_modules
|
|
COMMAND $<TARGET_FILE:aissia_tests> "[scheduler],[notification],[monitoring],[ai],[voice],[storage]"
|
|
DEPENDS aissia_tests
|
|
COMMENT "Running module integration tests"
|
|
)
|
|
|
|
# Run MCP tests only
|
|
add_custom_target(test_mcp
|
|
COMMAND $<TARGET_FILE:aissia_tests> "[mcp]"
|
|
DEPENDS aissia_tests
|
|
COMMENT "Running MCP integration tests"
|
|
)
|