Chapter 13. Wireshark Tests

Table of Contents

13.1. Quick Start
13.2. Test Coverage And Availability
13.3. Suites, Cases, and Tests
13.4. Listing And Running Tests
13.5. Adding Or Modifying Tests

The Wireshark sources include a collection of Python scripts that test the features of Wireshark, TShark, Dumpcap, and other programs that accompany Wireshark.

The command line options of Wireshark and its companion command line tools are numerous. These tests help to ensure that we don’t introduce bugs as Wireshark grows and evolves.

13.1. Quick Start

Before running any tests you should build the “test-programs” target. It is required for the “utittests” suite.

The main testing script is test.py. It will attempt to test as much as possible by default, including packet capture. This means that you will probably either have to supply a capture interface (--capture-interface <interface>) or disable capture tests (--disable-capture).

To run all tests from CMake do the following: * Pass -DTEST_EXTRA_ARGS=--disable-capture or -DTEST_EXTRA_ARGS=--capture-interface=<interface> as needed for your system. * Build the “test” target or run ctest, e.g. ctest --force-new-ctest-process -j 4 --verbose.

On Windows, “ctest” requires a build configuration parameter, e.g. ctest -C RelWithDebInfo --force-new-ctest-process -j 4 --verbose.

To run all tests directly, run test.py -p /path/to/wireshark-build/run-directory <capture args>.

To see a list of all options, run test.py -h or test.py --help.

To see a list of all tests, run test.py -l.