test(plugins): add parser unit tests for scapy_recon plugin (#1431)#1710
test(plugins): add parser unit tests for scapy_recon plugin (#1431)#1710Khanvilkarshravani27 wants to merge 2 commits into
Conversation
utksh1
left a comment
There was a problem hiding this comment.
Some of the scapy_recon parser tests are useful, but this PR is too bloated and mixes in unrelated parser_sandbox changes.\n\n1. Remove the unrelated backend/sandbox changes.\n2. Trim the test suite to the meaningful parser regression cases instead of large volumes of repetitive shape assertions.\n3. Keep the PR focused on the parser behavior only.\n\nPlease resubmit a smaller, more targeted test PR.
6e64234 to
ff9e761
Compare
|
Hi @utksh1, Thanks for the feedback — all points are now addressed:
Let me know if you'd like any further changes. |
665225c to
7e6f02f
Compare
utksh1
left a comment
There was a problem hiding this comment.
The unrelated sandbox code is gone, but this is still much larger than needed for parser regression coverage: it includes a broad metadata contract suite and many redundant shape assertions. Please reduce it to focused parser cases (normal output, empty output, malformed input, noise, and missing MAC), then rebase on current main and rerun CI.
Cover the scapy_recon plugin parser.py with targeted behavioural tests: - Metadata contract: file existence, valid JSON, required fields, engine binary, target/type field declarations - ARP output: host count, IP+MAC extraction, finding keys, category, severity, description content, metadata consistency, remediation - ICMP output: host count, IP extraction, Unknown-MAC default - Single-host edge case: IP+MAC in result and description - Malformed/empty input: empty string, whitespace-only, no UP: lines, mixed noise lines, malformed UP: lines, missing MAC separator No changes to backend source; test file only.
6f62855 to
12fab65
Compare
|
Hi @utksh1, All points addressed:
All 11 tests pass locally: |
Description
Adds a dedicated parser unit test suite for the
scapy_reconplugin to protect parser behaviour from regressions.The new test file (
testing/backend/test_scapy_recon_parser.py) includes 38 tests that cover:metadata.jsonstructure, required fields, engine binary, and output parser type."Unknown".Related Issues
Closes #1431
Type of Change
How Has This Been Tested?
Ran the test suite locally using pytest to ensure all new and existing tests pass:
Checklist