MarketAlly.AIPlugin.Extensions/MarketAlly.AIPlugin.Learnin.../RunTests.sh

80 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Bash script to run MarketAlly.AIPlugin.Learning tests
# Usage: ./RunTests.sh [test-filter] [verbosity-level]
TEST_FILTER=${1:-""}
VERBOSITY=${2:-"normal"}
COVERAGE=${3:-"false"}
LOGGER=${4:-"false"}
echo "🧪 Running MarketAlly.AIPlugin.Learning Tests"
echo "============================================="
# Change to test project directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Build the test project first
echo "🔨 Building test project..."
dotnet build --configuration Debug --verbosity quiet
if [ $? -ne 0 ]; then
echo "❌ Build failed. Please fix compilation errors first."
exit 1
fi
echo "✅ Build successful."
# Prepare test command
TEST_COMMAND="dotnet test --configuration Debug --verbosity $VERBOSITY --logger console"
# Add test filter if specified
if [ -n "$TEST_FILTER" ]; then
TEST_COMMAND="$TEST_COMMAND --filter \"$TEST_FILTER\""
echo "🔍 Running tests with filter: $TEST_FILTER"
fi
# Add coverage collection if requested
if [ "$COVERAGE" = "true" ]; then
TEST_COMMAND="$TEST_COMMAND --collect:\"XPlat Code Coverage\""
echo "📊 Code coverage collection enabled."
fi
# Add additional loggers if requested
if [ "$LOGGER" = "true" ]; then
TEST_COMMAND="$TEST_COMMAND --logger trx --logger html"
echo "📝 Additional loggers enabled (TRX, HTML)."
fi
echo ""
echo "🚀 Executing: $TEST_COMMAND"
echo ""
# Execute the test command
eval $TEST_COMMAND
# Check test results
if [ $? -eq 0 ]; then
echo ""
echo "✅ All tests passed!"
if [ "$COVERAGE" = "true" ]; then
echo "📊 Code coverage reports generated in TestResults folder."
fi
else
echo ""
echo "❌ Some tests failed. Check the output above for details."
exit 1
fi
echo ""
echo "📈 Test Summary by Category:"
echo " • SecurityService Tests: Security validation and sanitization"
echo " • UnifiedContextService Tests: Revolutionary context integration"
echo " • LLMContextService Tests: Intelligent code analysis"
echo " • LearningOrchestrator Tests: End-to-end learning workflows"
echo " • Configuration Tests: Settings validation and data annotations"
echo " • Exception Tests: Custom exception hierarchy"
echo " • Plugin Tests: Main plugin interface and integration"
echo " • Integration Tests: Full service integration scenarios"
echo ""