File size: 2,416 Bytes
aef804e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
#!/bin/bash
# Integration Test Runner Script
# Runs integration tests with optional coverage and filtering

# Change to backend directory
cd "$(dirname "$0")/../../../" || exit 1

# Default values
COVERAGE=false
VERBOSE=false
FILTER=""
TEST_PATH="tests/integration/workflows/"

# Parse command line arguments
while [[ $# -gt 0 ]]; do
    case $1 in
        --coverage)
            COVERAGE=true
            shift
            ;;
        --verbose)
            VERBOSE=true
            shift
            ;;
        --filter=*)
            FILTER="${1#*=}"
            shift
            ;;
        --filter)
            FILTER="$2"
            shift 2
            ;;
        --help)
            echo "Usage: $0 [OPTIONS]"
            echo ""
            echo "Options:"
            echo "  --coverage       Enable coverage reporting"
            echo "  --verbose        Verbose output (-vv)"
            echo "  --filter=NAME    Run specific test file or pattern"
            echo "  --help           Show this help message"
            echo ""
            echo "Examples:"
            echo "  $0                                    # Run all integration tests"
            echo "  $0 --coverage                        # Run with coverage"
            echo "  $0 --filter=test_workflow_engine_e2e # Run specific test"
            exit 0
            ;;
        *)
            echo "Unknown option: $1"
            echo "Use --help for usage information"
            exit 1
            ;;
    esac
done

# Build pytest command
PYTEST_CMD="pytest"

# Add coverage if requested
if [ "$COVERAGE" = true ]; then
    PYTEST_CMD="$PYTEST_CMD --cov=backend --cov-report=term-missing --cov-report=html"
fi

# Add verbose flag if requested
if [ "$VERBOSE" = true ]; then
    PYTEST_CMD="$PYTEST_CMD -vv"
else
    PYTEST_CMD="$PYTEST_CMD -v"
fi

# Add test path
if [ -n "$FILTER" ]; then
    PYTEST_CMD="$PYTEST_CMD $TEST_PATH$FILTER"
else
    PYTEST_CMD="$PYTEST_CMD $TEST_PATH"
fi

# Add pytest options
PYTEST_CMD="$PYTEST_CMD --tb=short --maxfail=5"

# Print command
echo "Running: $PYTEST_CMD"
echo ""

# Run pytest and capture exit code
eval "$PYTEST_CMD"
EXIT_CODE=$?

# Print summary
echo ""
if [ $EXIT_CODE -eq 0 ]; then
    echo "✓ Integration tests passed"
else
    echo "✗ Integration tests failed"
fi

exit $EXIT_CODE