[Interest] Need advice to add tests to an existing project

Xavier Bigand flamaros.xavier at gmail.com
Wed Nov 8 10:18:04 CET 2017


Yes your are right Christian, it is a graphical application in which were
already have minor tests that are executed before the application
initialization. As this is only math tests they don't have dependencies
with the application are made with the paradigm of contracts (input and
output asserts). Those tests doesn't generate text output for the moment.

But my main interest is to add some integration tests that will be
interactive, load application projects, modify them,... this with QtTest
module.
So yes I am thinking that you describe with --run-auto-tests, with the
options will be launched to run tests only and just leave at end.

You are answering my question, it should work as expected with QtTest. If I
can't use the "run all tests" in QtC it will be a minor inconvenience.


Thank a lot for help.



2017-11-08 7:38 GMT+01:00 Elvis Stansvik <elvstone at gmail.com>:

> 2017-11-08 2:35 GMT+01:00 Christian Gagneraud <chgans at gmail.com>:
> > On 8/11/2017 11:50 AM, Xavier Bigand wrote:
> >>
> >> Thank you Christian for answer.
> >>
> >> Yes I thought to create a static library of our project, but as we have
> >> many IDE it will be an effort to do that. So I think that I found a
> better
> >> solution as we already have a special build Developer for us, we can
> simply
> >> add support of new application command line options to launch it in
> >> automated test mode.
> >>
> >> But if I do that will we able to launch tests directly from QtCreator as
> >> suite tests or at least with a new running target (with correct launch
> >> options)?
> >
> >
> > I think i see what you're trying to do, let's see:
> > - you have an (GUI) app that has built-in auto-tests
> > - you want these auto-test to be executed by QtC when you hit the "run
> all
> > tests"
> > - your app needs extra parameter to tell it to run the auto-tests
> >
> > If you're on Linux, you could add a shell script that has a name (and a
> > path) compatible with QtC test scanner.
> > This shell script is as simple as:
> > ----
> > #!/bin/sh
> > set -e
> > relative/path/to/app --run-auto-tests
> > ----
> >
> > But then your app will have to generate test results compatible with
> either
> > QtTest or GoogleTest. I think they both generate junit files, so your
> app in
> > auto-test mode has to generate junit files, that QtC will be able to
> parse
> > and analyse.
>
> Just want to add: I know that at least in the case of GoogleTest, Qt
> Creator will parse the stdout/stderr output from gtest, not junit
> files (I know because I was recently trying to make some improvements
> there).
>
> Elvis
>
> >
> > Is it what you're trying to do?
> >
> > Chris
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>



-- 
Xavier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171108/d3c56319/attachment.html>


More information about the Interest mailing list