- docs/config.md: Configuration options, retry behavior, cleanup policies - docs/development.md: Local dev setup, building from source - docs/releasing.md: Version management, release process, AUR/Homebrew automation - docs/ci-cd.md: GitHub Actions workflows for build, release, AUR, Homebrew - docs/distribution.md: Package manager setup (WinGet, apt, AUR, Homebrew) - docs/auto-update.md: Built-in barn update command - docs/testing-automated.md: Test suite, running tests, CI integration - docs/testing-manual.md: Step-by-step manual test procedures - docs/jobs.md: Added retry-related state files - README.md: Updated documentation links Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
13 KiB
Manual Testing
This document provides step-by-step procedures for manually testing Barn functionality.
Overview
Manual testing is essential for:
- Verifying user-facing behavior
- Testing platform-specific features
- Exploratory testing
- Release validation
Test Environment Setup
Prerequisites
-
Build the barn binary:
./gradlew nativeCompile -
Add to PATH (optional):
export PATH=$PATH:$(pwd)/build/native/nativeCompile -
Create a clean test directory:
rm -rf /tmp/barn mkdir -p /tmp/barn
Verify Installation
barn --version
# Expected: barn 1.x.x
barn --help
# Expected: Usage information
Service Management Tests
Test: Start Service
Steps:
- Ensure service is not running:
barn service status - Start the service:
barn service start - Verify service is running:
barn service status
Expected:
- Status shows "running"
- Process ID is displayed
- No error messages
Verify:
# Check process exists
ps aux | grep barn
# Check IPC socket created (Unix)
ls -la /tmp/barn/barn.sock
# Check logs
cat /tmp/barn/logs/barn.log
Test: Stop Service
Steps:
- Ensure service is running
- Stop the service:
barn service stop - Verify service stopped:
barn service status
Expected:
- Status shows "stopped" or "not running"
- Process no longer exists
Test: Restart Service
Steps:
- Start the service
- Note the PID:
barn service status - Restart:
barn service restart - Verify new PID:
barn service status
Expected:
- Service restarts successfully
- New PID is different from old PID
Test: Reload Configuration
Steps:
- Start the service
- Modify configuration:
echo "[cleanup]" >> /etc/barn/barn.conf echo "max_age_hours = 24" >> /etc/barn/barn.conf - Reload:
barn service reload - Check logs for reload confirmation
Expected:
- Service continues running (same PID)
- Logs show "Configuration reloaded"
Job Execution Tests
Test: Run Simple Command
Steps:
- Run a command:
barn run echo "hello world" - Note the job ID from output
- Check job status:
barn status
Expected:
- Job ID is returned
- Status shows job as "succeeded"
- Exit code is 0
Test: Run Command (JSON Output)
Steps:
barn run --output=json echo "hello world"
Expected Output:
{
"job_id": "job-xxxxx",
"state": "queued",
"tag": null,
"created_at": "2026-01-21T10:00:00Z",
"exit_code": null
}
Verify JSON is valid:
barn run --output=json echo "hello" | jq .
Test: Run Command with Tag
Steps:
barn run --tag=download curl -o /tmp/test.txt https://example.com
barn status --tag=download
Expected:
- Job is tagged with "download"
- Filtering by tag shows only matching jobs
Test: Run Long-Running Command
Steps:
- Start a long command:
barn run sleep 30 - Immediately check status:
barn status - Verify heartbeat updates:
watch -n 1 'cat /tmp/barn/jobs/job-*/heartbeat'
Expected:
- Job shows as "running"
- Heartbeat timestamp updates every few seconds
Test: Run Failing Command
Steps:
barn run --output=json sh -c "exit 1"
barn status
Expected:
- Job state is "failed"
- Exit code is 1
- Error file contains failure reason
Verify files:
cat /tmp/barn/jobs/job-*/exit_code
cat /tmp/barn/jobs/job-*/error
Test: Run Command in Offline Mode
Steps:
- Stop service if running:
barn service stop - Run with offline flag:
barn run --offline echo "offline test"
Expected:
- Command executes without service
- Job files created in /tmp/barn/jobs/
Job Inspection Tests
Test: Describe Job
Steps:
- Run a command and note job ID
- Get job details:
barn describe job-xxxxx
Expected Output:
Job ID: job-xxxxx
State: succeeded
Tag: -
Created: 2026-01-21T10:00:00Z
Started: 2026-01-21T10:00:01Z
Finished: 2026-01-21T10:00:02Z
Exit Code: 0
PID: 12345
Command:
echo hello world
Logs:
stdout: /tmp/barn/jobs/job-xxxxx/logs/stdout.log
stderr: /tmp/barn/jobs/job-xxxxx/logs/stderr.log
Test: Describe Job (JSON)
Steps:
barn describe --output=json job-xxxxx
Expected:
- Valid JSON with all job fields
- Includes manifest, state, timestamps, logs
Test: View Job Logs
Steps:
- Run a command that produces output:
barn run sh -c "echo stdout; echo stderr >&2" - View logs:
cat /tmp/barn/jobs/job-xxxxx/logs/stdout.log cat /tmp/barn/jobs/job-xxxxx/logs/stderr.log
Expected:
- stdout.log contains "stdout"
- stderr.log contains "stderr"
Job Control Tests
Test: Kill Running Job
Steps:
- Start a long-running job:
barn run sleep 300 - Note the job ID
- Kill the job:
barn kill job-xxxxx - Verify:
barn describe job-xxxxx
Expected:
- Job state is "canceled"
- Process is terminated
- finished_at is recorded
Test: Kill Non-Existent Job
Steps:
barn kill job-nonexistent
Expected:
- Error message: "Job not found: job-nonexistent"
- Exit code is non-zero
Cleanup Tests
Test: Clean Completed Jobs
Steps:
- Run several jobs:
for i in 1 2 3; do barn run --offline echo "test $i"; done - Verify jobs exist:
ls /tmp/barn/jobs/ barn status - Clean up:
barn clean - Verify cleaned:
ls /tmp/barn/jobs/ barn status
Expected:
- Completed jobs are removed
- Job directories deleted
Test: Clean with Dry Run
Steps:
barn clean --dry-run
Expected:
- Shows what would be deleted
- No actual deletion occurs
- Job directories still exist
Test: Clean Jobs Older Than
Steps:
- Create jobs with old timestamps (manual file manipulation):
# Create a job dir with old timestamp mkdir -p /tmp/barn/jobs/job-old echo "succeeded" > /tmp/barn/jobs/job-old/state touch -d "2 days ago" /tmp/barn/jobs/job-old/finished_at - Clean with age filter:
barn clean --older-than=24h
Expected:
- Old jobs are removed
- Recent jobs are kept
Test: Clean Including Failed Jobs
Steps:
- Create a failed job:
barn run --offline sh -c "exit 1" - Default clean (should keep failed):
barn clean barn status - Clean with include-failed:
barn clean --include-failed barn status
Expected:
- Default clean preserves failed jobs
- --include-failed removes them
Retry Behavior Tests
Test: Automatic Retry on Failure
Setup: Configure retries in barn.conf:
[jobs]
max_retries = 3
retry_delay_seconds = 5
Steps:
- Create a script that fails twice then succeeds:
cat > /tmp/flaky.sh << 'EOF' #!/bin/bash COUNT_FILE="/tmp/flaky_count" COUNT=$(cat $COUNT_FILE 2>/dev/null || echo 0) COUNT=$((COUNT + 1)) echo $COUNT > $COUNT_FILE if [ $COUNT -lt 3 ]; then echo "Attempt $COUNT - failing" exit 1 fi echo "Attempt $COUNT - success" exit 0 EOF chmod +x /tmp/flaky.sh rm -f /tmp/flaky_count - Run the flaky command:
barn run /tmp/flaky.sh - Wait for retries and check status:
watch barn status
Expected:
- Job retries automatically
- Eventually succeeds on 3rd attempt
- retry_count file shows retry history
Test: Max Retries Exceeded
Steps:
- Run a command that always fails:
barn run sh -c "exit 1" - Wait for all retries to exhaust
- Check final status:
barn describe job-xxxxx
Expected:
- Job state is "failed"
- retry_count equals max_retries
- No more retry attempts
Output Format Tests
Test: Human-Readable Output (Default)
Steps:
barn status
Expected:
- Formatted table or list
- Human-readable timestamps
- Clear column headers
Test: JSON Output
Steps:
barn status --output=json | jq .
Expected:
- Valid JSON
- Array of job objects
- ISO 8601 timestamps
Test: XML Output
Steps:
barn status --output=xml | xmllint --format -
Expected:
- Valid XML
- Proper element structure
- XML declaration present
Platform-Specific Tests
Linux (systemd)
Test: Service Integration
# After installing .deb
sudo systemctl status barn
sudo systemctl start barn
sudo systemctl stop barn
sudo journalctl -u barn
macOS (launchd)
Test: Service Integration
# After brew install
brew services list
brew services start barn
brew services stop barn
cat /usr/local/var/log/barn.log
Windows (Service)
Test: Service Integration
# After MSI install
Get-Service BarnService
Start-Service BarnService
Stop-Service BarnService
Get-EventLog -LogName Application -Source Barn
Crash Recovery Tests
Test: Service Crash Recovery
Steps:
- Start service and create a long-running job:
barn service start barn run sleep 300 - Force-kill the service:
pkill -9 -f "barn service" - Restart service:
barn service start - Check orphaned job status:
barn status
Expected:
- Orphaned job detected
- State changed to "failed"
- exit_code set to "orphaned_process"
Test: System Reboot Recovery
Steps:
- Create a running job
- Reboot the system
- After reboot, start service and check status
Expected:
- Previous running jobs marked as failed/orphaned
- Service recovers cleanly
Concurrent Access Tests
Test: Multiple Simultaneous Jobs
Steps:
# Run 10 jobs in parallel
for i in $(seq 1 10); do
barn run --tag=batch sleep 5 &
done
wait
# Check status
barn status --tag=batch
Expected:
- All jobs execute (respecting max_concurrent_jobs)
- No file corruption
- All jobs complete successfully
Test: Multiple CLI Clients
Steps:
- Open two terminals
- In terminal 1:
watch -n 0.5 barn status - In terminal 2:
for i in $(seq 1 20); do barn run echo $i; sleep 0.5; done
Expected:
- Status updates in real-time
- No IPC errors
- All jobs visible
Update Tests
Test: Check for Updates
Steps:
barn update --check
Expected:
- Shows current version
- Shows latest available version
- Indicates if update available
Test: Perform Update
Steps:
sudo barn update
Expected:
- Downloads new binary
- Verifies checksum
- Replaces binary
- Restarts service if running
Test: Rollback Update
Steps:
sudo barn update --rollback
barn --version
Expected:
- Previous version restored
- Service continues working
Error Handling Tests
Test: Invalid Command
Steps:
barn invalidcommand
Expected:
- Error message with suggestion
- Non-zero exit code
Test: Missing Arguments
Steps:
barn run
Expected:
- Error: "Missing command to run"
- Usage hint displayed
Test: Permission Denied
Steps:
# As non-root user
barn run --offline touch /root/test.txt
Expected:
- Job runs and fails
- Error captured in job's error file
- Exit code is non-zero
Test Checklist
Use this checklist before each release:
Basic Functionality
barn --versionshows correct versionbarn --helpdisplays usagebarn service start/stop/statusworksbarn run <cmd>executes commandsbarn statuslists jobsbarn describe <id>shows job detailsbarn kill <id>terminates jobsbarn cleanremoves old jobs
Output Formats
- Human-readable output is formatted correctly
- JSON output is valid
- XML output is valid
Platform-Specific
- Linux: systemd integration works
- macOS: launchd integration works
- Windows: Service Control Manager works
Error Handling
- Invalid commands show helpful errors
- Missing service shows clear message
- Permission errors are handled gracefully
Recovery
- Service recovers from crash
- Orphaned jobs are detected
- State files are not corrupted
Reporting Issues
When reporting bugs found during manual testing:
- Environment: OS, version, architecture
- Steps to reproduce: Exact commands run
- Expected behavior: What should happen
- Actual behavior: What actually happened
- Logs: Relevant output and log files
- Screenshots: If applicable
Submit issues at: https://github.com/samson-media/barn/issues
Next Steps
- Automated Testing - Automated test suite
- Development Guide - Development setup