Regression test a Wireshark dissector using tshark
This post shows how you can use some basic command line utilities, and tshark, to automate regression testing of a Wireshark dissector.
Create baseline test result
for f in *.pcap*; do echo $f; tshark -r "$f" -V; done > result.txt
This will run tshark on files in the current directory with the
pcapng extension, and write the output to
-V flag tells tshark to output packet tree.
To test regression, use diff
diff result.txt <(for f in *.pcap*; do echo $f; tshark -r "$f" -V; done)
Any output produced by the above could be a result of
A valid change - if so, update the baseline test result
A bug - create a bug report with the output
This should work on macOS, Linux, and on Windows in the Git Bash shell.