run_tests.sh
1 #!/bin/bash 2 3 # Kamaji Go Test Suite Runner 4 set -e 5 6 echo "๐งช Kamaji Go Test Suite" 7 echo "=======================" 8 9 # Colors for output 10 RED='\033[0;31m' 11 GREEN='\033[0;32m' 12 YELLOW='\033[1;33m' 13 BLUE='\033[0;34m' 14 NC='\033[0m' # No Color 15 16 # Test categories 17 UNIT_TESTS="./internal/tools/... ./internal/config/... ./internal/providers/..." 18 INTEGRATION_TESTS="./test/..." 19 20 echo -e "${BLUE}๐ Running Unit Tests...${NC}" 21 if go test -v $UNIT_TESTS; then 22 echo -e "${GREEN}โ Unit tests passed${NC}" 23 else 24 echo -e "${RED}โ Unit tests failed${NC}" 25 exit 1 26 fi 27 28 echo "" 29 echo -e "${BLUE}๐ Running Integration Tests...${NC}" 30 if go test -v $INTEGRATION_TESTS; then 31 echo -e "${GREEN}โ Integration tests passed${NC}" 32 else 33 echo -e "${RED}โ Integration tests failed${NC}" 34 exit 1 35 fi 36 37 echo "" 38 echo -e "${BLUE}โก Running Benchmarks...${NC}" 39 go test -bench=. -benchmem ./test/... | grep -E "(Benchmark|PASS|FAIL)" 40 41 echo "" 42 echo -e "${BLUE}๐ Test Coverage...${NC}" 43 go test -cover $UNIT_TESTS $INTEGRATION_TESTS 44 45 echo "" 46 echo -e "${BLUE}๐๏ธ Build Test...${NC}" 47 if go build -o bin/kamaji-test ./cmd/kamaji; then 48 echo -e "${GREEN}โ Build successful${NC}" 49 rm -f bin/kamaji-test 50 else 51 echo -e "${RED}โ Build failed${NC}" 52 exit 1 53 fi 54 55 echo "" 56 echo -e "${GREEN}๐ All tests passed!${NC}" 57 echo "" 58 echo -e "${YELLOW}๐ Test Summary:${NC}" 59 echo "โข Unit tests: Tools, Config, Providers" 60 echo "โข Integration tests: CLI, Agents, Workflows" 61 echo "โข Performance tests: Startup time, Tool execution" 62 echo "โข Build verification: Binary compilation"