Forum Discussion

mortoray's avatar
mortoray
New Contributor
14 years ago

QT Exposing data to TestComplete

Our application is written in C++ using QT and one of our testers is using TestComplete to automate some of the testing effort. We have several interfaces that are quite customized, though usually based on one of the standard controls.



I'd like to know if there is a way for me (as the programmer) to expose additional data to TestComplete inside QWidget objects?



Is there any way that TestComplete could gain access to the properties as set by QObject::setProperty and retrieved via QObject::property?


9 Replies

  • Hi,


    If you declare a property by using the Q_PROPERTY macro and this property is added to Meta-Object System, TestComplete will be able to access it.

    Also, you can compile the application with debug information to provide TestComplete with deeper access to the application's internals. Let me quote the Qt Open Applications help topic:


    In addition, if the Debug Info Agentâ„¢ is enabled, it provides scripts with access to protected and private properties and methods. Note that, the Agent will make protected and private properties and methods accessible to TestComplete only if the Read debug information for statically linked libraries option is enabled (for detailed information, see Project Properties - Debug Agent Options).

  • mortoray's avatar
    mortoray
    New Contributor
    Okay, this implies that TestComplete has access to the properties. Do they have to be declared with Q_PROPERTY, or is anything set via setProperty also available?



    I don't know exactly how TestComplete works, but dynamic properties are enumerable, so in theory they are also listable and accessible.



    Using a debug build is not an option for us.
  • Hi,


    Currently, TestComplete is able to access only properties known to the meta-object system. If you add a property by using a setProperty() call and do not use the Q_PROPERTY macro for it, the property will not be available to TestComplete.

    However, I can register your request to implement support for the dynamic properties added by the setProperty() call, and we will consider implementing it in the future. Please let me know if you want me to do this.



  • mortoray's avatar
    mortoray
    New Contributor
    Yes, access to the dynamic properties would be a huge advantage.  We have a lot of data we'd like to expose for testing purposes only, and don't want to introduce it into the static meta data.  Being able to call setProperty and have TestComplete see it would allow any widget to quickly expose all sorts of data.



    For now we'll limit the exposed data and use Q_PROPERTY.



    Thank you for your help.
  • rdemers25's avatar
    rdemers25
    New Contributor
    I'm the tester that is trying to read these values.  I don't see any of the exposed values, do I need to do something to see these exposed values.  I attached the properties I currently see.
  • Hi Richard,


    I see a lot of native properties in your screenshots. That is, to me, it seems that TestComplete works correctly for you (note that support for dynamic properties is not implemented in TestComplete).

    Could you please clarify what properties are missing there? If possible, please send us a sample application demonstrating the problem.

  • rdemers25's avatar
    rdemers25
    New Contributor
    This is the declaration in the code from the developer



    The exact declaration in the code, in CommonGrid is below.



    public:

        market_value_t getMidValue() const

        { return midValue; }

        Q_PROPERTY(market_value_t midValue READ getMidValue WRITE setMidValue)





    I'm working with them on getting an example grid.
  • Richard,


    Thank you for the code snippet.

    TestComplete cannot access properties that use custom types in their declaration. Your property is declared by using the market_value_t custom type. We will add the corresponding information to our Help system.