-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·89 lines (71 loc) · 2.47 KB
/
Copy pathrun-tests.sh
File metadata and controls
executable file
·89 lines (71 loc) · 2.47 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
echo "🧪 Running TaskGenix Tests"
echo "==========================="
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${2}${1}${NC}"
}
# Check if dotnet is installed
if ! command -v dotnet &> /dev/null; then
print_status "❌ .NET SDK is not installed or not in PATH" $RED
exit 1
fi
print_status "📋 .NET SDK version:" $YELLOW
dotnet --version
# Change to the project root directory
cd "$(dirname "$0")"
print_status "\n🔧 Restoring packages..." $YELLOW
dotnet restore
if [ $? -ne 0 ]; then
print_status "❌ Package restoration failed" $RED
exit 1
fi
print_status "✅ Package restoration completed" $GREEN
dotnet test TaskGenix.Tests.Unit/TaskGenix.Tests.Unit.csproj --verbosity minimal --logger "console;verbosity=detailed"
dotnet test TaskGenix.Tests.Integration/TaskGenix.Tests.Integration.csproj --filter "FullyQualifiedName~InMemory" --verbosity minimal --logger "console;verbosity=detailed"
# Run Unit Tests
print_status "\n🧪 Running Unit Tests..." $YELLOW
print_status "=========================" $YELLOW
dotnet test TaskGenix.Tests.Unit/TaskGenix.Tests.Unit.csproj --verbosity minimal --logger "console;verbosity=detailed"
if [ $? -eq 0 ]; then
print_status "✅ Unit tests passed" $GREEN
else
print_status "❌ Unit tests failed" $RED
UNIT_TEST_FAILED=1
fi
# Run Integration Tests (all)
print_status "\n🧪 Running Integration Tests..." $YELLOW
print_status "==============================" $YELLOW
dotnet test TaskGenix.Tests.Integration/TaskGenix.Tests.Integration.csproj --verbosity minimal --logger "console;verbosity=detailed"
if [ $? -eq 0 ]; then
print_status "✅ Integration tests passed" $GREEN
else
print_status "❌ Integration tests failed" $RED
INTEGRATION_TEST_FAILED=1
fi
# Summary
print_status "\n📊 Test Summary" $YELLOW
print_status "===============" $YELLOW
if [ -z "$UNIT_TEST_FAILED" ]; then
print_status "✅ Unit Tests: PASSED" $GREEN
else
print_status "❌ Unit Tests: FAILED" $RED
fi
if [ -z "$INTEGRATION_TEST_FAILED" ]; then
print_status "✅ Integration Tests: PASSED" $GREEN
else
print_status "❌ Integration Tests: FAILED" $RED
fi
# Exit with error if any tests failed
if [ ! -z "$UNIT_TEST_FAILED" ] || [ ! -z "$INTEGRATION_TEST_FAILED" ]; then
print_status "\n❌ Some tests failed" $RED
exit 1
else
print_status "\n🎉 All tests passed!" $GREEN
exit 0
fi