-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile.test
More file actions
138 lines (124 loc) · 5.03 KB
/
Makefile.test
File metadata and controls
138 lines (124 loc) · 5.03 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.PHONY: test test-unit test-integration test-security test-api test-ui test-smoke test-smoke-containerized test-all test-ui-failfast test-single test-single-ui test-clean test-help
# Unified test entry
test:
./tests/run_tests.sh all
# Help for testing commands
test-help:
@echo "🧪 Sorting Office - Testing Commands"
@echo "===================================="
@echo ""
@echo "Test Types:"
@echo " Unit Tests:"
@echo " make test-unit - Run only unit tests (80 tests)"
@echo " cargo test --lib - Alternative: run unit tests directly"
@echo ""
@echo " Integration Tests:"
@echo " make test-integration - Run integration tests with database"
@echo " TEST_THREADS=N make test-integration - Set parallelism (default: 8)"
@echo " cargo test --test integration - Alternative: run directly"
@echo ""
@echo " Security Tests:"
@echo " make test-security - Run security tests (SQL injection, auth bypass)"
@echo " cargo test --test security - Alternative: run directly"
@echo ""
@echo " API Tests:"
@echo " make test-api - Run API tests (authentication, authorization)"
@echo " cargo test --test api - Alternative: run directly"
@echo ""
@echo " UI Tests:"
@echo " make test-ui - Run containerized UI tests (Selenium)"
@echo " cargo test --test ui_containerized - Alternative: run directly"
@echo ""
@echo " Smoke Tests:"
@echo " make test-smoke [URL] - Run end-to-end smoke test (default: localhost:3000)"
@echo " make test-smoke-containerized - Run end-to-end smoke test with testcontainers"
@echo " cargo test ui_smoke_e2e_flow -- --ignored - Alternative: run directly"
@echo " cargo test ui_smoke_e2e_flow_testcontainers -- --ignored - Alternative: run testcontainers directly"
@echo ""
@echo " Test Data Utilities:"
@echo " cargo test --test test_data_utilities - Run test data utility tests"
@echo ""
@echo " All Tests:"
@echo " make test - Run all tests (unit + integration + security + api + UI)"
@echo " make test-all - Run all tests with explicit breakdown"
@echo " ./tests/run_tests.sh all - Alternative: run via test runner"
@echo ""
@echo "Test Infrastructure:"
@echo " Selenium Setup (deprecated - now using testcontainers):"
@echo " Selenium is now automatically managed by testcontainers"
@echo " No manual setup required for smoke tests"
@echo ""
@echo " Test Database:"
@echo " make test-db-setup - Setup test database"
@echo " docker compose --profile test up -d - Start test containers"
@echo ""
@echo " Test Cleanup:"
@echo " make test-clean - Remove all test containers"
@echo " make clean-rust - Clean Rust artifacts"
@echo ""
@echo " Individual Test Runners:"
@echo " make test-single TEST=<name> - Run individual test with cleanup"
@echo " make test-single-ui TEST=<name> - Run individual UI test with cleanup"
@echo ""
@echo " Test Runner:"
@echo " ./tests/run_tests.sh help - Show test runner help"
@echo " ./tests/run_tests.sh unit - Run specific test type"
test-unit:
@echo "Running unit tests..."
@tests/run_tests.sh unit
test-integration:
@echo "Running integration tests..."
@TEST_THREADS=$${TEST_THREADS:-8} tests/run_tests.sh integration
test-security:
@echo "Running security tests..."
@tests/run_tests.sh security
test-api:
@echo "Running API tests..."
@tests/run_tests.sh api
test-ui:
@echo "Running UI tests..."
@tests/run_tests.sh ui
test-smoke:
@echo "Running end-to-end smoke test..."
@echo "Usage: make test-smoke [URL=http://localhost:3000]"
@echo "Prerequisites:"
@echo " 1. Start app: cargo run (in another terminal)"
@echo " 2. Ensure app is running on the specified URL (default: http://localhost:3000)"
@echo " (Selenium is automatically managed by testcontainers)"
@echo ""
@tests/run_tests.sh smoke $(URL)
test-smoke-containerized:
@echo "Running end-to-end smoke test with testcontainers..."
@echo "This will start its own isolated environment with:"
@echo " - Testcontainers database"
@echo " - Testcontainers app container"
@echo " - Testcontainers selenium container"
@echo ""
# @echo "Building Docker image first..."
# @make build
# @echo ""
@tests/run_tests.sh smoke-containerized
test-all: test-unit test-integration test-security test-api test-ui
@echo "All tests completed!"
test-ui-failfast:
./tests/run_tests.sh ui --fail-fast
# Individual test runners with cleanup
test-single:
@if [ -z "$(TEST)" ]; then \
echo "❌ Error: TEST parameter is required"; \
echo "Usage: make test-single TEST=test_name"; \
echo "Example: make test-single TEST=test_homepage_loads_containerized"; \
exit 1; \
fi
@./tests/run_tests.sh single $(TEST)
test-single-ui:
@if [ -z "$(TEST)" ]; then \
echo "❌ Error: TEST parameter is required"; \
echo "Usage: make test-single-ui TEST=test_name"; \
echo "Example: make test-single-ui TEST=test_homepage_loads_containerized"; \
exit 1; \
fi
@./tests/run_tests.sh single-ui $(TEST)
# Cleanup
test-clean:
@./tests/run_tests.sh cleanup