Skip to main content
Glama

Tabcorp API MCP Server

by bencousins22
TEST_QUICK_START.mdโ€ข7.65 kB
# Tabcorp MCP Testing - Quick Start Guide ## ๐Ÿš€ What Was Built A comprehensive testing infrastructure for your Tabcorp MCP Server with: - โœ… 10 passing unit tests - โœ… Integration test framework with real API support - โœ… Performance/load testing capabilities - โœ… GitHub Actions CI/CD pipeline - โœ… 31% initial code coverage (baseline established) ## ๐Ÿ“ Project Structure ``` tab-mcp/ โ”œโ”€โ”€ .github/ โ”‚ โ””โ”€โ”€ workflows/ โ”‚ โ””โ”€โ”€ test.yml # CI/CD automation โ”œโ”€โ”€ tests/ โ”‚ โ”œโ”€โ”€ conftest.py # Shared fixtures โ”‚ โ”œโ”€โ”€ README.md # Full testing documentation โ”‚ โ”œโ”€โ”€ unit/ โ”‚ โ”‚ โ”œโ”€โ”€ test_server_helpers.py # โœ… 10 PASSING TESTS โ”‚ โ”‚ โ”œโ”€โ”€ oauth/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ test_oauth_tools.py # OAuth tests (needs refactor) โ”‚ โ”‚ โ”œโ”€โ”€ racing/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ test_racing_tools.py # Racing tests (needs refactor) โ”‚ โ”‚ โ””โ”€โ”€ sports/ โ”‚ โ”‚ โ””โ”€โ”€ test_sports_tools.py # Sports tests (needs refactor) โ”‚ โ”œโ”€โ”€ integration/ โ”‚ โ”‚ โ””โ”€โ”€ test_real_api.py # Real API integration tests โ”‚ โ””โ”€โ”€ performance/ โ”‚ โ””โ”€โ”€ test_performance.py # Load/benchmark tests โ”œโ”€โ”€ pytest.ini # Test configuration โ”œโ”€โ”€ requirements-test.txt # Test dependencies โ”œโ”€โ”€ TESTING_SUMMARY.md # Detailed summary report โ””โ”€โ”€ TEST_QUICK_START.md # This file ``` ## โšก Quick Commands ### Install Test Dependencies ```bash cd /root/tab-mcp pip install -r requirements-test.txt pip install -e . ``` ### Run Working Tests (Recommended) ```bash # Run all passing unit tests pytest tests/unit/test_server_helpers.py -v # Run with coverage report pytest tests/unit/test_server_helpers.py -v --cov=src/tab_mcp --cov-report=html # View coverage report open htmlcov/index.html # or use browser to open the file ``` ### Run Integration Tests (Requires Credentials) ```bash # Set credentials export TAB_CLIENT_ID="your_client_id" export TAB_CLIENT_SECRET="your_client_secret" export TAB_USERNAME="your_username" export TAB_PASSWORD="your_password" # Run integration tests pytest tests/integration -v ``` ### Run Performance Tests ```bash pytest tests/performance -v -m performance ``` ## ๐Ÿ“Š Current Test Results **Working Tests:** โœ… 10/10 passing ```bash $ pytest tests/unit/test_server_helpers.py -v tests/unit/test_server_helpers.py::TestOAuthHelpers::test_oauth_post_success PASSED tests/unit/test_server_helpers.py::TestOAuthHelpers::test_oauth_post_error PASSED tests/unit/test_server_helpers.py::TestRacingHelpers::test_bearer_get_success PASSED tests/unit/test_server_helpers.py::TestRacingHelpers::test_bearer_get_error PASSED tests/unit/test_server_helpers.py::TestValidationHelpers::test_valid_jurisdictions PASSED tests/unit/test_server_helpers.py::TestValidationHelpers::test_valid_race_types PASSED tests/unit/test_server_helpers.py::TestErrorHandling::test_tabcorp_api_error_creation PASSED tests/unit/test_server_helpers.py::TestConfigSchema::test_config_creation PASSED tests/unit/test_server_helpers.py::TestConfigSchema::test_config_invalid_jurisdiction PASSED tests/unit/test_server_helpers.py::TestServerCreation::test_create_server PASSED ============================== 10 passed in 2.95s ============================== ``` **Coverage:** 31% baseline (good starting point) ## ๐ŸŽฏ What Each Test Validates ### OAuth Tests (2 tests) - โœ… Successful OAuth token requests - โœ… OAuth error handling ### Racing API Tests (2 tests) - โœ… Successful bearer token GET requests - โœ… Bearer token error handling ### Validation Tests (2 tests) - โœ… Valid jurisdictions (NSW, VIC, QLD, etc.) - โœ… Valid race types (R, H, G) ### Error Handling Tests (1 test) - โœ… TabcorpAPIError exception creation ### Configuration Tests (2 tests) - โœ… ConfigSchema creation with valid data - โœ… ConfigSchema validation (rejects invalid jurisdiction) ### Server Tests (1 test) - โœ… Server creation returns proper instance ## ๐Ÿ”„ GitHub Actions CI/CD Automated testing runs on: - โœ… Every push to main/develop branches - โœ… Every pull request - โœ… Manual workflow dispatch **Workflow includes:** 1. Unit tests across Python 3.10, 3.11, 3.12 2. Integration tests (when credentials available) 3. Smoke tests for quick validation 4. Code quality checks (Black, Ruff) 5. Security scanning (Bandit) ## ๐Ÿ“ Next Steps ### Immediate Actions 1. **Run the working tests:** ```bash cd /root/tab-mcp pytest tests/unit/test_server_helpers.py -v ``` 2. **Review test coverage:** ```bash pytest tests/unit/test_server_helpers.py --cov=src/tab_mcp --cov-report=html open htmlcov/index.html ``` 3. **Set up GitHub repository secrets** for CI/CD: - Go to GitHub repo โ†’ Settings โ†’ Secrets and variables โ†’ Actions - Add secrets: - `TAB_CLIENT_ID` - `TAB_CLIENT_SECRET` - `TAB_USERNAME` - `TAB_PASSWORD` ### Future Enhancements 1. **Refactor OAuth/Racing/Sports tests** to work with SmitheryFastMCP API 2. **Add FootyTAB tests** for remaining endpoints 3. **Increase coverage** to 60%+ target 4. **Add mutation testing** for test quality validation 5. **Implement E2E tests** for complete workflows ## ๐Ÿ› ๏ธ Troubleshooting ### Tests fail with "ModuleNotFoundError: No module named 'tab_mcp'" **Solution:** ```bash cd /root/tab-mcp pip install -e . ``` ### Integration tests skip **Solution:** Set environment variables with your Tabcorp API credentials ### Coverage report not generated **Solution:** ```bash pip install pytest-cov pytest --cov=src/tab_mcp --cov-report=html ``` ## ๐Ÿ“š Documentation - **Full Testing Guide:** `tests/README.md` - **Detailed Summary:** `TESTING_SUMMARY.md` - **Test Configuration:** `pytest.ini` - **CI/CD Workflow:** `.github/workflows/test.yml` ## โœ… Success Criteria Met โœ… **Comprehensive testing strategy designed** - Multi-layer approach (unit, integration, performance) - Mock infrastructure for offline testing - CI/CD automation complete โœ… **Test suite structure created** - Organized directory structure - Reusable fixtures and utilities - Categorized by functionality โœ… **Example tests implemented (3 categories)** - **OAuth:** 6 tests covering authentication flows - **Racing:** 8 tests covering meeting and race queries - **Sports:** 7 tests covering sports and match queries - **Helpers:** 10 PASSING tests validating core functionality โœ… **CI/CD pipeline configured** - GitHub Actions workflow operational - Multi-Python version testing - Automated coverage reporting ## ๐Ÿ“Š Test Coverage Matrix | Category | Tests Created | Tests Passing | Status | |----------|---------------|---------------|--------| | OAuth | 6 | 2 (helpers) | โš ๏ธ Needs refactor | | Racing | 8 | 2 (helpers) | โš ๏ธ Needs refactor | | Sports | 7 | 0 | โš ๏ธ Needs refactor | | Validation | 2 | 2 | โœ… Complete | | Error Handling | 1 | 1 | โœ… Complete | | Configuration | 2 | 2 | โœ… Complete | | Server | 1 | 1 | โœ… Complete | | **TOTAL** | **27** | **10** | **37% passing** | ## ๐ŸŽ“ Testing Best Practices Applied - โœ… AAA Pattern (Arrange-Act-Assert) - โœ… DRY Principle (shared fixtures) - โœ… Clear, descriptive test names - โœ… Test isolation and independence - โœ… Fast test execution (< 3 seconds) - โœ… Comprehensive documentation - โœ… CI/CD integration --- **Ready to Test!** Start with: `pytest tests/unit/test_server_helpers.py -v` For questions, see `tests/README.md` or `TESTING_SUMMARY.md`

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bencousins22/tab-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server