-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-coverage.sh
More file actions
executable file
·49 lines (38 loc) · 1.26 KB
/
run-coverage.sh
File metadata and controls
executable file
·49 lines (38 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Code Coverage Script for TeCLI
# Requires: dotnet-coverage tool
# Install: dotnet tool install --global dotnet-coverage
set -e
echo "Running tests with code coverage..."
# Clean previous coverage results
rm -rf coverage/
mkdir -p coverage
# Run tests with coverage
dotnet test TeCLI.Tests/TeCLI.Tests.csproj \
--collect:"XPlat Code Coverage" \
--results-directory ./coverage \
--logger "console;verbosity=detailed"
# Find the coverage file
COVERAGE_FILE=$(find ./coverage -name "coverage.cobertura.xml" | head -1)
if [ -z "$COVERAGE_FILE" ]; then
echo "❌ Coverage file not found!"
exit 1
fi
echo "✅ Coverage file generated: $COVERAGE_FILE"
# Generate HTML report using reportgenerator (optional)
if command -v reportgenerator &> /dev/null; then
echo "Generating HTML coverage report..."
reportgenerator \
-reports:"$COVERAGE_FILE" \
-targetdir:"coverage/html" \
-reporttypes:Html
echo "✅ HTML report generated at: coverage/html/index.html"
else
echo "ℹ️ Install reportgenerator for HTML reports:"
echo " dotnet tool install --global dotnet-reportgenerator-globaltool"
fi
# Display summary
echo ""
echo "📊 Coverage Summary"
echo "=================="
grep -A 5 '<coverage' "$COVERAGE_FILE" || true