aissia/tests/CMakeLists.txt
StillHammer 93800ca6bb feat: Add IT_009 end-to-end conversation loop test
Ajout du test d'intégration le plus complet qui valide toute
la boucle conversationnelle AISSIA en conditions réelles.

Test IT_009_FullConversationLoop:
- Scénario en 3 étapes validant le flux complet
- Step 1: Voice "Prends note que j'aime le C++"
  → AI → LLM (appelle storage_save_note) → Storage sauvegarde
- Step 2: Voice "Qu'est-ce que j'aime ?"
  → AI → LLM (appelle storage_query_notes) → Storage récupère
- Step 3: Validation cohérence conversationnelle

Validations:
 Communication Voice → AI → LLM
 Exécution tools MCP (storage_save_note, storage_query_notes)
 Persistence et retrieval de données
 Cohérence conversation multi-tour
 Cleanup automatique des fichiers de test

Résultat final: 9/9 tests d'intégration opérationnels
- 4 tests MCP (tools)
- 4 tests flux (communications inter-modules)
- 1 test end-to-end (boucle complète)

Total: ~35s pour valider AISSIA en conditions réelles

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 19:43:37 +08:00

169 lines
5.3 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
${CMAKE_SOURCE_DIR}/src/modules/WebModule.cpp
# Module tests (70 TI)
modules/SchedulerModuleTests.cpp
modules/NotificationModuleTests.cpp
modules/MonitoringModuleTests.cpp
modules/AIModuleTests.cpp
modules/VoiceModuleTests.cpp
modules/StorageModuleTests.cpp
modules/WebModuleTests.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
)
# WebModule needs httplib and OpenSSL
target_include_directories(aissia_tests PRIVATE
${httplib_SOURCE_DIR}
)
if(OPENSSL_FOUND)
target_link_libraries(aissia_tests PRIVATE OpenSSL::SSL OpenSSL::Crypto)
target_compile_definitions(aissia_tests PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
endif()
# 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],[web]"
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"
)
# ============================================================================
# Integration Test Modules (Dynamic .so files)
# ============================================================================
# Helper macro to create integration test modules
macro(add_integration_test TEST_NAME)
add_library(${TEST_NAME} SHARED
integration/${TEST_NAME}.cpp
)
target_include_directories(${TEST_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src
)
target_link_libraries(${TEST_NAME} PRIVATE
GroveEngine::impl
spdlog::spdlog
)
set_target_properties(${TEST_NAME} PROPERTIES
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests/integration
)
endmacro()
# Individual integration test modules (will be added as we create them)
# Phase 2: MCP Tests
add_integration_test(IT_001_GetCurrentTime)
add_integration_test(IT_002_FileSystemWrite)
add_integration_test(IT_003_FileSystemRead)
add_integration_test(IT_004_MCPToolsList)
# Phase 3: Flow Tests
add_integration_test(IT_005_VoiceToAI)
add_integration_test(IT_006_AIToLLM)
add_integration_test(IT_007_StorageWrite)
add_integration_test(IT_008_StorageRead)
# Phase 4: End-to-End Test
add_integration_test(IT_009_FullConversationLoop)
# Phase 5: Module Tests
# add_integration_test(IT_010_SchedulerHyperfocus)
# add_integration_test(IT_011_NotificationAlert)
# add_integration_test(IT_012_MonitoringActivity)
# add_integration_test(IT_013_WebRequest)
# Custom target to build all integration tests
add_custom_target(integration_tests
DEPENDS
IT_001_GetCurrentTime
IT_002_FileSystemWrite
IT_003_FileSystemRead
IT_004_MCPToolsList
IT_005_VoiceToAI
IT_006_AIToLLM
IT_007_StorageWrite
IT_008_StorageRead
IT_009_FullConversationLoop
COMMENT "Building all integration test modules"
)