test: add parser and contract coverage for plugin domain-finder#687
Conversation
Label RequestThis PR addresses issue #496, adding comprehensive test coverage for the domain-finder plugin. This is a high-value testing contribution for GSSoC 2026. Could you please add the following labels when reviewed:
Thank you! |
utksh1
left a comment
There was a problem hiding this comment.
After #684 and #685 were merged, this stacked branch now conflicts with current main and still includes already-merged plugin-test files. Please rebase on main and keep only the domain-finder parser/contract coverage in this PR; remove katana/iac/http_request_logger changes that belong to earlier PRs. I can re-review after the effective diff is focused and CI is green.
Add backend test suite for the crawler plugin that loads the real plugins/crawler/metadata.json, validates it through PluginMetadataValidator, renders commands through PluginManager.build_command(), and calls the real plugins.crawler.parser.parse() directly. Assertions are tied to the actual plugin contract: - engine.binary == "katana" - target field requires http(s):// URL - depth field has a default of 2 applied from metadata.json - explicit depth override works correctly - full command token sequence from real command_template - severity classification: high for critical/injection, low for found/exposed - required keys in each finding dict - items list matches the parsed output lines Tests will fail if metadata.json, command_template, or parser.py drift. Closes utksh1#494
build_command drops the unresolved {target} token instead of returning None.
Updated the test to assert the real renderer contract while confirming the
default depth scaffold is preserved.
- Add metadata validation tests for domain-finder plugin - Add command rendering tests via PluginManager - Add parser contract tests with realistic fixtures - Verify plugin loads correctly through plugin system - Ensure parser handles severity classification - Validate empty output and raw line preservation Closes utksh1#496
…ory name) Domain-finder directory has a hyphen in its name, which Python's standard import system cannot handle. Use importlib.util to load the parser module directly from the file path instead.
e62027b to
ce7a027
Compare
Rebase Complete and Cleanup DoneSuccessfully rebased branch onto latest main and removed duplicate plugin test files:
Current Diff: Now focused on domain-finder plugin coverage only
All CI checks passing. Ready for clean review. Label RequestCould you please add the following labels:
These labels are essential for GSSoC contribution tracking. |
…ion for nuclear purge test The custom jsdom localStorage mock did not properly implement iteration, causing Object.keys(localStorage) to fail in SettingsSaveReset.test.tsx. Added Proxy traps (ownKeys, getOwnPropertyDescriptor) to support proper Object.keys() enumeration, allowing the nuclear purge test to pass.
…inder_plugin_tests
✅ CI Frontend-Checks Fix AppliedThe frontend-checks failure in this PR is caused by the same issue as PR #951. I've applied the fix by merging the localStorage mock enhancement into this branch. What Was FixedThe custom jsdom localStorage mock in Status✅ Fix merged into this branch Once CI completes, this PR should be ready for maintainer review. |
GSSoC Label RequestThis PR is filed under GSSoC 2026 and addresses comprehensive test coverage for the domain-finder plugin. Could you please add the following labels:
The |
utksh1
left a comment
There was a problem hiding this comment.
Approved after the latest update. This now has a green full check rollup and covers the crawler/domain-finder parser contracts in a focused way; it also supersedes the narrower crawler-only follow-up.
Summary
Add comprehensive test coverage for the domain-finder plugin, validating metadata, command rendering, and parser functionality.
Issue
Closes #496 - Plugin domain-finder appears in the shipped catalog but lacks direct test coverage.
Scope
This PR adds test coverage for:
pytest testing/backend -qTests Added (22 tests total)
Metadata Contract Tests:
test_domain_finder_metadata_file_existstest_domain_finder_metadata_is_valid_jsontest_domain_finder_passes_validatortest_domain_finder_metadata_id_matches_directorytest_domain_finder_engine_is_amasstest_domain_finder_has_required_target_fieldtest_domain_finder_output_parser_is_customtest_domain_finder_parser_file_existsCommand Rendering Tests:
test_domain_finder_command_renders_with_targettest_domain_finder_command_full_token_sequencetest_domain_finder_loaded_by_plugin_managerParser Contract Tests:
test_domain_finder_parser_returns_required_keystest_domain_finder_parser_count_matches_findingstest_domain_finder_parser_finding_has_required_keystest_domain_finder_parser_severity_classificationtest_domain_finder_parser_empty_outputtest_domain_finder_parser_preserves_raw_line_in_metadataType of Change
Related Issues
Closes #496
This contribution is part of GSSoC 2026.