Unit testing with Qt Test - tutorial series
-
Hi,
Nice ! Thank you very much.
-
@vivaladav Thanks for sharing!
-
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.
-
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 :)
-
@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 :)
-
@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.
-
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.
-
@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") ?
-
Wonderful!
-
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.
-
@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.
-
This post is deleted!
-
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.