ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Unittesting the Qt UI

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Mon, 5 Aug 2019 15:48:41 -0700
To get up and running quickly you should be able to add something like the following to the case_unittests class in suite_unittests.py:


    def test_unit_qt_test(self, program, base_env):
        '''qt_test'''
        self.assertRun(program('name_of_test_program'), env=base_env)

You can then run just your test with `test/test.py -p /path/to/build/run test_unit_qt_test`.

If there a lot of different executables it might make sense to create a separate suite_qt.py module. More information can be found at https://www.wireshark.org/docs/wsdg_html_chunked/ChTestsDevelop.html

On 8/5/19 12:45 AM, Roland Knall wrote:
> Hi
> 
> I am currently building unittests to ensure, that the ProfileModel
> implementation does not change functionality. Also, in the future, I want
> to implement coverage to help further sanitize code.
> 
> I am at loss though on how to integrate my tests in our test framework.
> Currently I've created a directory ui/test, which contains a separate
> subdirectory per testcase. The reason for that is, that I have a lot of
> stubs for certain testcases and those differ between test cases.
> 
> How would I integrate those testcases in our main test system, to ensure,
> that those tests run on every PD build?
> 
> Anyone tried something similar in the past and can provide some pointers
> (not unittesting in general, as those are rather regression tests, but
> testing with Wireshark)?
> 
> The test framework in question I am using is QtTest.
> 
> Any help would be appreciated
> 
> kind regards
> Roland
> 
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>