run-tests.sh
1.71 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
#!/bin/bash
# MCP Test Runner Script
# This script runs comprehensive tests for the MCP interface
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MOQUI_MCP_DIR="$(dirname "$SCRIPT_DIR")"
echo -e "${BLUE}🧪 MCP Test Suite${NC}"
echo -e "${BLUE}==================${NC}"
echo ""
# Check if Moqui MCP server is running
echo -e "${YELLOW}🔍 Checking if MCP server is running...${NC}"
if ! curl -s -u "john.sales:opencode" "http://localhost:8080/mcp" > /dev/null 2>&1; then
echo -e "${RED}❌ MCP server is not running at http://localhost:8080/mcp${NC}"
echo -e "${YELLOW}Please start the server first:${NC}"
echo -e "${YELLOW} cd moqui-mcp-2 && ../gradlew run --daemon > ../server.log 2>&1 &${NC}"
exit 1
fi
echo -e "${GREEN}✅ MCP server is running${NC}"
echo ""
# Change to Moqui MCP directory
cd "$MOQUI_MCP_DIR"
# Build the project
echo -e "${YELLOW}🔨 Building MCP project...${NC}"
../gradlew build > /dev/null 2>&1
echo -e "${GREEN}✅ Build completed${NC}"
echo ""
# Run the test client
echo -e "${YELLOW}🚀 Running MCP Test Client...${NC}"
echo ""
# Run Groovy test client
groovy -cp "lib/*:build/libs/*:../framework/build/libs/*:../runtime/lib/*" \
test/client/McpTestClient.groovy
echo ""
echo -e "${YELLOW}🛒 Running E-commerce Workflow Test...${NC}"
echo ""
# Run E-commerce workflow test
groovy -cp "lib/*:build/libs/*:../framework/build/libs/*:../runtime/lib/*" \
test/workflows/EcommerceWorkflowTest.groovy
echo ""
echo -e "${BLUE}📋 All tests completed!${NC}"
echo -e "${YELLOW}Check the output above for detailed results.${NC}"