84 lines
2.8 KiB
PowerShell
Executable File
84 lines
2.8 KiB
PowerShell
Executable File
# PowerShell script to run MarketAlly.AIPlugin.Learning tests
|
|
# Usage: .\RunTests.ps1 [test-filter] [verbosity-level]
|
|
|
|
param(
|
|
[string]$TestFilter = "",
|
|
[string]$Verbosity = "normal",
|
|
[switch]$Coverage = $false,
|
|
[switch]$Logger = $false
|
|
)
|
|
|
|
Write-Host "🧪 Running MarketAlly.AIPlugin.Learning Tests" -ForegroundColor Cyan
|
|
Write-Host "=============================================" -ForegroundColor Cyan
|
|
|
|
# Change to test project directory
|
|
$TestProjectPath = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
Set-Location $TestProjectPath
|
|
|
|
# Build the test project first
|
|
Write-Host "🔨 Building test project..." -ForegroundColor Yellow
|
|
dotnet build --configuration Debug --verbosity quiet
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "❌ Build failed. Please fix compilation errors first." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "✅ Build successful." -ForegroundColor Green
|
|
|
|
# Prepare test command
|
|
$TestCommand = "dotnet test"
|
|
$TestCommand += " --configuration Debug"
|
|
$TestCommand += " --verbosity $Verbosity"
|
|
$TestCommand += " --logger console"
|
|
|
|
# Add test filter if specified
|
|
if ($TestFilter) {
|
|
$TestCommand += " --filter `"$TestFilter`""
|
|
Write-Host "🔍 Running tests with filter: $TestFilter" -ForegroundColor Magenta
|
|
}
|
|
|
|
# Add coverage collection if requested
|
|
if ($Coverage) {
|
|
$TestCommand += " --collect:`"XPlat Code Coverage`""
|
|
Write-Host "📊 Code coverage collection enabled." -ForegroundColor Magenta
|
|
}
|
|
|
|
# Add additional loggers if requested
|
|
if ($Logger) {
|
|
$TestCommand += " --logger trx --logger html"
|
|
Write-Host "📝 Additional loggers enabled (TRX, HTML)." -ForegroundColor Magenta
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "🚀 Executing: $TestCommand" -ForegroundColor Blue
|
|
Write-Host ""
|
|
|
|
# Execute the test command
|
|
Invoke-Expression $TestCommand
|
|
|
|
# Check test results
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host ""
|
|
Write-Host "✅ All tests passed!" -ForegroundColor Green
|
|
|
|
if ($Coverage) {
|
|
Write-Host "📊 Code coverage reports generated in TestResults folder." -ForegroundColor Cyan
|
|
}
|
|
} else {
|
|
Write-Host ""
|
|
Write-Host "❌ Some tests failed. Check the output above for details." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "📈 Test Summary by Category:" -ForegroundColor Cyan
|
|
Write-Host " • SecurityService Tests: Security validation and sanitization"
|
|
Write-Host " • UnifiedContextService Tests: Revolutionary context integration"
|
|
Write-Host " • LLMContextService Tests: Intelligent code analysis"
|
|
Write-Host " • LearningOrchestrator Tests: End-to-end learning workflows"
|
|
Write-Host " • Configuration Tests: Settings validation and data annotations"
|
|
Write-Host " • Exception Tests: Custom exception hierarchy"
|
|
Write-Host " • Plugin Tests: Main plugin interface and integration"
|
|
Write-Host " • Integration Tests: Full service integration scenarios"
|
|
Write-Host "" |