Add e2e/ dir with Robot Framework tests for page loading, ban records, blocklist import, config edit. Add requirements.txt. Update Makefile with test commands. Update .gitignore, backend docs, testing requirements docs.
1.9 KiB
1.9 KiB
Testing Requirements
Coverage Threshold
- Minimum: 80% line coverage for all backend code
- Critical paths (auth, banning, scheduling, API endpoints): 100%
CI Enforcement
.github/workflows/ci.yml runs pytest with --cov-fail-under=80. Build fails if coverage drops below threshold.
Running Tests Locally
cd backend
pytest --cov=app --cov-report=term-missing
Coverage Reports
- Terminal:
--cov-report=term-missing - HTML:
--cov-report=html(output inhtmlcov/)
Coverage Badge
Add to README once CI runs successfully:
[](https://codecov.io/gh/<owner>/BanGUI)
Requires codecov.io integration with repository.
Writing Tests
- Follow pattern:
test_<unit>_<scenario>_<expected> - Mock external dependencies (fail2ban socket, aiohttp calls)
- Test happy path AND error/edge cases
- See
Docs/Backend-Development.md §9for detailed testing guide
E2E Testing
An end-to-end test suite using Robot Framework with the Browser library (Playwright-backed) exercises the full running stack: frontend → backend → fail2ban → database.
Running E2E Tests
make e2e
Requires:
BANGUI_SESSION_SECRETenv var must be set (see Backend-Development.md for setup)- Stack must be startable via
make up(Docker/Podman + compose installed) rfbrowser initis run automatically by thee2etarget (Playwright browsers downloaded on first run; re-run afterrobotframework-browserversion changes)
HTML Report
After a run, open e2e/results/report.html in a browser to view the detailed HTML report with screenshots on failure.
Writing New E2E Tests
Place new .robot files in e2e/tests/. Use e2e/resources/common.resource for shared variables and setup/teardown, and e2e/resources/auth.resource for the Login As Admin keyword.