- Add GdUnit4 v6.2.1 framework in addons/gdUnit4/ - Create test directory structure (tests/unit/, tests/integration/, tests/mocks/) - Add unit tests for MusicPlayer.gd (8 tests) - Add unit tests for MainWindow.gd (15+ tests) - Add unit tests for Settings.gd (5 tests) - Add unit tests for Playlist.gd (11 tests) - Add integration tests for full flow (10+ tests) - Add MockHTTPRequest for HTTP request mocking - Add TestHelpers with utility functions - Add Gitea Actions CI workflow (.gitea/workflows/test.yml) - Add .runsettings for GdUnit4 CLI configuration - Add run_tests.sh for convenient test execution - Add TESTING.md with comprehensive documentation - Add TESTING_PLAN.md with implementation details - Update .gitignore for test artifacts - Enable GdUnit4 plugin in project.godot Features: - Test button functionality (play, pause, search, sync, etc.) - Mock REST API requests to server - Test complete application flows - Run tests in CI (headless mode) - Run tests in GUI for visual feedback - JUnit XML and HTML test reports Generated by OpenCode AI assistant.
83 lines
1.6 KiB
Bash
Executable File
83 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# GdUnit4 Test Runner for MusicPlayer
|
|
# Usage: ./run_tests.sh [--headless] [--verbose]
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Default flags
|
|
HEADLESS=false
|
|
VERBOSE=false
|
|
|
|
# Parse arguments
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--headless)
|
|
HEADLESS=true
|
|
;;
|
|
--verbose)
|
|
VERBOSE=true
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Godot executable (adjust if needed)
|
|
GODOT_EXEC="godot"
|
|
|
|
# Check if Godot is available
|
|
if ! command -v "$GODOT_EXEC" &> /dev/null; then
|
|
echo "Error: Godot executable not found at: $GODOT_EXEC"
|
|
echo "Please ensure Godot 4.7 is installed and in your PATH"
|
|
exit 1
|
|
fi
|
|
|
|
# Build arguments
|
|
GODOT_ARGS=(
|
|
"--path" "."
|
|
"-s" "addons/gdUnit4/test.gd"
|
|
"--gdunit.cli"
|
|
)
|
|
|
|
if [ "$HEADLESS" = true ]; then
|
|
GODOT_ARGS+=("--headless")
|
|
fi
|
|
|
|
if [ "$VERBOSE" = true ]; then
|
|
GODOT_ARGS+=("--verbose")
|
|
fi
|
|
|
|
echo "Running tests with Godot..."
|
|
echo "Command: $GODOT_EXEC ${GODOT_ARGS[*]}"
|
|
echo ""
|
|
|
|
# Run tests
|
|
"$GODOT_EXEC" "${GODOT_ARGS[@]}"
|
|
EXIT_CODE=$?
|
|
|
|
# Check results
|
|
echo ""
|
|
if [ $EXIT_CODE -eq 0 ]; then
|
|
echo "✓ All tests passed!"
|
|
else
|
|
echo "✗ Tests failed with exit code: $EXIT_CODE"
|
|
fi
|
|
|
|
# Check for test results files
|
|
if [ -f "test_results.xml" ]; then
|
|
echo ""
|
|
echo "Test results:"
|
|
echo " - JUnit XML: test_results.xml"
|
|
echo " - HTML: test_results.html"
|
|
|
|
# Count failures
|
|
FAILURES=$(grep -c '<failure' test_results.xml || true)
|
|
if [ "$FAILURES" -gt 0 ]; then
|
|
echo " - Failures: $FAILURES"
|
|
fi
|
|
fi
|
|
|
|
exit $EXIT_CODE
|