Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

System Level Testing with Qt



  • Hello,

    I've been looking around for a built-in Qt framework that allows for system-level testing. I know Qt Test exists, but from what I've gathered that's more for unit tests and not system-level tests. I was told to look into QJSEngine (scripting capabilities), but that doesn't seem to have the ability or be used for testing applications with a GUI. Does Qt provide anything that can support that? I've seen third party software like Squish, but I'm looking for something made by Qt.

    Thank you


  • Lifetime Qt Champion

    Hi,

    What exactly to do you mean with "System Level Testing" ? Can you give an example ?



  • @SGaist said in System Level Testing with Qt:

    Hi,

    What exactly to do you mean with "System Level Testing" ? Can you give an example ?

    Certainly. If we have a GUI that is already made with various widgets, is there something that someone other than the developer can create to test the GUI without having to know the entire functionality of the GUI?

    For example, a basic GUI with a push button, line edit field, and LCD. Enter a value in the field, push the button, and have the output be displayed on the LCD. Is there some way we can automate tests on that GUI and collect data from it? But the tester shouldn't know anything about how the GUI operates (just how it looks).


  • Lifetime Qt Champion

    Your answer is a bit paradoxal... You want a tester to write tests while knowing nothing about your application.

    Squish is currently the right tool for that and has Qt integration.

    Can you explain how you envision the writing of these tests ?



  • @SGaist said in System Level Testing with Qt:

    Your answer is a bit paradoxal... You want a tester to write tests while knowing nothing about your application.

    Squish is currently the right tool for that and has Qt integration.

    Can you explain how you envision the writing of these tests ?

    We are researching more into Qt and I was given this as a task. I figured I'd ask the question since I couldn't find really anything other than Squish.

    Do you know what QJSEngine/QtScript are used for? I was initially instructed to research those first since they utilized JavaScript and we could possibly write scripts to test the GUIs, but my research bore no fruit.


  • Lifetime Qt Champion

    QtScript has been deprecated a long time ago so I would not start a new project with it.

    Since you wrote that the test writers shall know nothing about your application structure I do not see how a scripting engine like that would help you since you need to know what you want to manipulate.

    Another possibly could be to use Selenium. There's a webdriver for Qt. I can't comment on it as I have not used it.



  • @SGaist said in System Level Testing with Qt:

    QtScript has been deprecated a long time ago so I would not start a new project with it.

    Since you wrote that the test writers shall know nothing about your application structure I do not see how a scripting engine like that would help you since you need to know what you want to manipulate.

    Another possibly could be to use Selenium. There's a webdriver for Qt. I can't comment on it as I have not used it.

    Thanks for the suggestions and info, I really appreciate it. Could you clarify/give more info on what applications I would use QJSEngine for? I'm still struggling a bit to understand it's purpose.


  • Lifetime Qt Champion

    Add scripting support in your application for example.



  • @SGaist said in System Level Testing with Qt:

    Add scripting support in your application for example.

    So then couldn't I write a script in JS that would test my GUI? Like I'm not sure what capabilities I have once I add scripting support.


  • Lifetime Qt Champion

    You are losing me a bit.

    You want to write test but at the same time, not know the details of the application so it's getting hairy...



  • Hi, I'm in a similar situation. I am a Selenium test automation engineer, and I've been given the task of using Selenium to launch a browser and test a GUI built with QT.

    I'm new to the project that I'm on, and, the GUI is being built by a sub-contractor. So, other than knowing it's being built in / with QT, I don't know anything about it. I'm trying to determine if Selenium is even an option.

    Is it true that QT GUIs do not have HTML elements? Normally I would do something like this (simplified to illustrate a point):

    String labelText = myWebDriver.findElement(By.xPath("/html/body/label_1")).getText();

    Selenium is built to test web sites with HTML, CSS, etc. QtWebDriver is the only utility that seems to exist to enable Selenium to interact with QT based GUIs.

    Is there something that I'm missing?

    Thanks in advance,
    Dennis


  • Lifetime Qt Champion

    @DennisR Hi and welcome to devnet,

    Qt is not a web based framework although you can now make use of its WASM implementation to load an application through a browser.

    In any case, even if it's a subcontractor that implements the UI, its design and screens should be documented somewhere to get you a starting point for your scenarios.

    That contractor can also provide you with regular builds that will give you the opportunity to make your testing.

    In the absolute, you should be able to build the application and run the tests completely yourself.



  • @SGaist Thanks! Glad to be here.

    What you say is true, and my understanding is that our users will go through a browser to access the Qt App.

    My level of test automation starts at the user experience - if you're familiar with Cucumber for Behavior Driven Development and Selenium for automation, then you'll understand where I'm at.

    I do not expect to have to (or need to) build the app. The Dev team will deliver nightly builds and my job is to test the way that the users will use the system. From a "testing pyramid" perspective, it's closer to User Acceptance / User Functional testing.

    I am very much NOT a developer :)

    My understanding of QtWebDriver was that it would run in the background, listen on a specified port, and then Selenium could use that port to interact with the Qt GUI (such as click a button, or type data into a field).

    Maybe you can tell me, in the world of Qt, how is User Functional testing performed, and automated?

    Best Regards,
    Dennis


  • Lifetime Qt Champion

    That's just a wild guess but you might be able to use Selenium as usual if your application is built for WASM.

    Otherwise, AFAIK, the reference tool is Squish.