Skip to main content
Glama
TEST_INFRASTRUCTURE.md•6.68 kB
# Test Infrastructure Update - Summary ## šŸŽÆ Overview Implemented YAML-based test configuration system to centralize test parameters across all MCP ABAP ADT handlers. This eliminates the need for hardcoded test values and makes it easy to update environment-specific settings (especially transport requests). ## āœ… What Was Done ### 1. Created Test Infrastructure **`tests/test-config.yaml`** - Central test configuration - Defines test cases for each handler (create_domain, get_class, get_table, etc.) - Each test case has: name, enabled flag, description, and parameters - Easy to enable/disable specific tests - Clear markers (āš ļø) for values that must be updated before testing **`tests/test-helper.js`** - Reusable test utilities - `getEnabledTestCase(handlerName)` - Load test from YAML - `printTestHeader()` - Formatted test banners - `printTestParams()` - Pretty-print parameters - `printTestResult()` - Parse and display results - `validateTransportRequest()` - Warn about default values - `waitForConfirmation()` - Countdown before destructive operations **`tests/run-all-tests.js`** - Universal test runner - Run all enabled tests: `node tests/run-all-tests.js` - Run specific handler: `node tests/run-all-tests.js create_domain` - List all tests: `node tests/run-all-tests.js --list` - Supports fail-fast, verbose output, and retry settings ### 2. Updated Test Scripts Migrated the following tests to use YAML config: - āœ… `test-create-domain.js` - New CreateDomain handler test - āœ… `test-get-class.js` - Class retrieval - āœ… `test-get-table.js` - Table structure - āœ… `test-get-table-contents.js` - Table data - āœ… `test-search-object.js` - Object search - āœ… `test-get-sql-query.js` - SQL queries All updated tests support: - YAML configuration (default) - Command-line override (for ad-hoc testing) - Consistent output formatting - Proper error handling ### 3. Documentation **`tests/README.md`** - Updated with YAML-based testing guide - Quick start instructions - Test configuration structure - Running tests (single, multiple, all) - Adding new tests - Troubleshooting **`doc/CREATE_DOMAIN_TOOL.md`** - CreateDomain handler documentation - Complete API reference - Workflow steps (lock → create → check → unlock → activate → verify) - Session management architecture - Input parameters and examples - Error handling and limitations ## šŸ“ File Structure ``` tests/ ā”œā”€ā”€ test-config.yaml # ⭐ Central test configuration ā”œā”€ā”€ test-helper.js # ⭐ Common utilities ā”œā”€ā”€ run-all-tests.js # ⭐ Universal test runner ā”œā”€ā”€ README.md # ⭐ Updated testing guide ā”œā”€ā”€ test-create-domain.js # ⭐ Uses YAML config ā”œā”€ā”€ test-get-class.js # ⭐ Uses YAML config ā”œā”€ā”€ test-get-table.js # ⭐ Uses YAML config ā”œā”€ā”€ test-get-table-contents.js # ⭐ Uses YAML config ā”œā”€ā”€ test-search-object.js # ⭐ Uses YAML config ā”œā”€ā”€ test-get-sql-query.js # ⭐ Uses YAML config └── ... (other legacy tests) doc/ └── CREATE_DOMAIN_TOOL.md # ⭐ New CreateDomain documentation ``` ## šŸš€ Usage Examples ### Update Test Configuration Edit `tests/test-config.yaml`: ```yaml create_domain: test_cases: - name: "basic_char_domain" enabled: true params: domain_name: "ZZ_TEST_MCP_01" transport_request: "E19K905999" # Your transport! package_name: "ZOK_LOCAL" ``` ### Run Tests ```bash # Compile first npm run build # Run single test from YAML node tests/test-create-domain.js # Run with CLI override node tests/test-get-class.js CL_ABAP_TYPEDESCR # Run all enabled tests for a handler node tests/run-all-tests.js create_domain # Run all enabled tests node tests/run-all-tests.js # List available tests node tests/run-all-tests.js --list ``` ## šŸŽÆ Benefits ### Before (Hardcoded Values) ```javascript const args = { domain_name: 'ZZ_TEST_MCP_01', transport_request: 'E19K905635', // āŒ Hardcoded, needs editing package_name: 'ZOK_LOCAL' }; ``` ### After (YAML Config) ```yaml # tests/test-config.yaml create_domain: test_cases: - name: "basic_test" enabled: true params: domain_name: "ZZ_TEST_MCP_01" transport_request: "E19K905635" # āœ… One place to update ``` ### Advantages 1. **Single Source of Truth**: All test parameters in one YAML file 2. **Easy Maintenance**: Update transport request once, affects all tests 3. **Enable/Disable**: Toggle tests without code changes 4. **Multiple Scenarios**: Define multiple test cases per handler 5. **CLI Override**: Still supports ad-hoc command-line testing 6. **Consistency**: Same helper functions across all tests ## šŸ”„ Migration Path for Other Tests To migrate a legacy test: 1. Add test case to `tests/test-config.yaml`: ```yaml my_handler: test_cases: - name: "test_case_name" enabled: true params: param1: value1 ``` 2. Update test script: ```javascript const { getEnabledTestCase, printTestResult } = require('./test-helper'); const testCase = getEnabledTestCase('my_handler'); const result = await handleMyHandler(testCase.params); printTestResult(result, 'MyHandler'); ``` 3. Register in `tests/run-all-tests.js`: ```javascript const HANDLER_MAP = { 'my_handler': () => require('../dist/handlers/handleMyHandler').handleMyHandler, }; ``` ## šŸ“ Next Steps 1. āœ… Update `transport_request` in `test-config.yaml` before running create_domain tests 2. āœ… Enable/disable test cases as needed 3. āœ… Run `npm run build` before testing 4. āœ… Test CreateDomain functionality on real SAP system 5. ā³ Migrate remaining legacy tests to YAML config (optional) 6. ā³ Add more test cases for edge scenarios 7. ā³ Integrate with CI/CD pipeline ## āš ļø Important Notes - **Transport Requests**: Must be updated in YAML before running write operations - **Environment**: Tests load `.env` file (default: `e19.env`) - **Dependencies**: Run `npm install` (yaml package now installed) - **Build**: Always run `npm run build` after code changes - **Legacy Tests**: Old tests still work but don't use YAML config ## šŸ“Š Test Coverage Current YAML-configured handlers: - āœ… create_domain - āœ… get_class - āœ… get_table - āœ… get_table_contents - āœ… get_package - āœ… search_object - āœ… get_sql_query - āœ… get_where_used - āœ… get_object_info - āœ… get_abap_ast - āœ… get_abap_semantic_analysis Legacy tests (not yet migrated): - test-get-program.js (uses spawn) - test-enhancement-*.js (specialized tests) - test-includes-*.js (specialized tests) - ... and others

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/fr0ster/mcp-abap-adt'

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