Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unit testing with Qt Test - tutorial series

    Showcase
    11
    17
    5815
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • VRonin
      VRonin last edited by

      Thanks, may I suggest a "integrating test results" section to describe how to feed Qt Test results to systems like Travis CI and Jenkins?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      V 1 Reply Last reply Reply Quote 4
      • ?
        A Former User @vivaladav last edited by

        @vivaladav Thanks for sharing!

        1 Reply Last reply Reply Quote 2
        • V
          vivaladav @VRonin last edited by vivaladav

          @VRonin that's a great idea for a 4th post. I will definitely do it!

          Thank you for the suggestion.

          Davide Coppola
          blog | Linkedin | Twitter

          1 Reply Last reply Reply Quote 2
          • V
            vivaladav last edited by

            I have just published the second tutorial: C++ unit testing with Qt Test – part 2 – advanced testing.

            It explains how to handle a project with multiple unit tests and how to implement data driven testing. There are also examples of more testing macros and an overview of the Qt Test integration offered by Qt Creator.

            Questions, comments and feedback are always welcome.

            Davide Coppola
            blog | Linkedin | Twitter

            1 Reply Last reply Reply Quote 4
            • P
              Paul Thexton last edited by

              Hi,

              I wish I'd found this tutorial a few days ago when I started looking at some (Basic) unit testing using Qt!

              On the subject of feeding Qt Test results in to other systems, I've been doing that to get the results in to TFS/VSTS (it's what we're using at work, it's non-negotiable) and I've found that the xunitxml support in Qt is actually xunit v1, whereas VSTS/TFS only supports xunit v2 xml.

              I've put together an XSL stylesheet to do the transformation for me, but really it's a pretty clunky way around the problem and I'd much prefer the test runner logs directly to a suitable format.

              Where would be the best place to suggest updating it (or adding an additional format)? Alternatively I'd be happy to submit code to update this via open source, but I'm not sure where to start looking for how to contribute code!

              I'll look forward to reading your following blogs :)

              V J 2 Replies Last reply Reply Quote 3
              • V
                vivaladav @Paul Thexton last edited by

                @Paul-Thexton hey Paul,

                I am not a Qt developer, but to the best of my knowledge you could create a feature request in the Qt bug tracker or you can submit a patch using Gerrit.

                Let us know how it goes :)

                Davide Coppola
                blog | Linkedin | Twitter

                aha_1980 1 Reply Last reply Reply Quote 5
                • aha_1980
                  aha_1980 Lifetime Qt Champion @vivaladav last edited by

                  @vivaladav said in Unit testing with Qt Test - tutorial series:

                  @Paul-Thexton hey Paul,

                  I am not a Qt developer, but to the best of my knowledge you could create a feature request in the Qt bug tracker or you can submit a patch using Gerrit.

                  Let us know how it goes :)

                  Your knowledge is correct :)

                  @Paul-Thexton I think such a contribution would be very helpful for others also.

                  Qt has to stay free or it will die.

                  1 Reply Last reply Reply Quote 3
                  • V
                    vivaladav last edited by

                    Happy new year!

                    I have just published the third tutorial: GUI unit testing with Qt Test – part 1 – introduction

                    In this tutorial I will introduce GUI unit testing with Qt Test, the Qt framework for C++ unit testing. In particular I will discuss how to write a basic unit test for a widget class, how to simulate mouse and keyboard events and how to write data driven tests.

                    Any feedback and questions always welcome.

                    Davide Coppola
                    blog | Linkedin | Twitter

                    1 Reply Last reply Reply Quote 3
                    • J
                      JulienMaille @Paul Thexton last edited by

                      @Paul-Thexton said in Unit testing with Qt Test - tutorial series:

                      Hi,

                      I wish I'd found this tutorial a few days ago when I started looking at some (Basic) unit testing using Qt!

                      On the subject of feeding Qt Test results in to other systems, I've been doing that to get the results in to TFS/VSTS (it's what we're using at work, it's non-negotiable) and I've found that the xunitxml support in Qt is actually xunit v1, whereas VSTS/TFS only supports xunit v2 xml.

                      I've put together an XSL stylesheet to do the transformation for me, but really it's a pretty clunky way around the problem and I'd much prefer the test runner logs directly to a suitable format.

                      Where would be the best place to suggest updating it (or adding an additional format)? Alternatively I'd be happy to submit code to update this via open source, but I'm not sure where to start looking for how to contribute code!

                      I'll look forward to reading your following blogs :)

                      I see you work with VSTS, which is also what we have at work. Were you able to setup automatic build on VSTS (ie handle all qt depencies required to compile on the online "agent") ?

                      P 1 Reply Last reply Reply Quote 1
                      • C
                        Charlie_Hdz last edited by

                        Wonderful!

                        Kind Regards,
                        Enrique Hernandez
                        gearstech.com.mx
                        chernandez@gearstech.com.mx

                        1 Reply Last reply Reply Quote 1
                        • V
                          vivaladav last edited by

                          Finally I published the 4th and final part of this series: GUI unit testing with Qt Test – part 2 – advanced testing

                          This tutorial will introduce more advanced features of Qt Test dedicated to GUI unit testing. In particular it will show how to simulate and handle keyboard focus and how to test Qt signals when unit testing a Graphical User Interface.

                          Any feedback and questions always welcome.

                          Davide Coppola
                          blog | Linkedin | Twitter

                          1 Reply Last reply Reply Quote 4
                          • P
                            Paul Thexton @JulienMaille last edited by

                            @JulienMaille apologies, I didn't get a notification about your message. As far as I know you're probably not going to be able to use the Microsoft 'Hosted' build agents for building Qt projects, I created my own build agent on a Linux VM.

                            1 Reply Last reply Reply Quote 0
                            • owenlevinee
                              owenlevinee Banned last edited by

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • D
                                david_wang last edited by

                                OH MAN ! This is exactly what I want!
                                I am looking for how to run all Unit testing at one time (part2)

                                This is really helpful.

                                1 Reply Last reply Reply Quote 0
                                • T
                                  Tayyab3 Banned last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post