[PyQt] QTestLib

Ruslan Popov ruslan.popov at gmail.com
Sun Oct 17 08:06:29 BST 2010


I've found a solution.

        self.dialog = DlgLogin(self)
        self.dialog.setCallback(callback)
        self.dialog.setModal(True)

        dialog = self.findChild(QWidget, QString('dialog_login'))
        print dialog
        login = dialog.findChild(QWidget, QString('editLogin'))
        login.setText('rad')
        print login
        password = dialog.findChild(QWidget, QString('editPassword'))
        password.setText('q1')
        print password
        ok = dialog.findChild(QWidget, QString('buttonOk'))
        print ok

I think to move second section of this code to separate thread and run it to
test application. But I need to understand what result is and how to check
this result from my testing thread.

On Sun, Oct 17, 2010 at 12:46 AM, Ruslan Popov <ruslan.popov at gmail.com>wrote:

> It's time to back to this question.
> I want to implement simple action replaying framework to test PyQt apps.
>
> I have main window and one dialog with two lineedits.
>
> I can open this dialog but don't understand how to access it from my
> framework to fill lineedits with data and accepts the dialog. Any ideas?
>
>
> On Sun, Jan 17, 2010 at 1:28 AM, Andreas Pakulat <apaku at gmx.de> wrote:
>
>> On 17.01.10 00:08:39, Ruslan Popov wrote:
>> > Can someone share an example of using QTestLib with GUI application?
>> > I've read manuals and some Qt4 books, but they talk about C++ way, not
>> > Python.
>>
>> I don't think QTestlib works so easily in python as it uses a special
>> macro in C++ to generate the boilerplate code to start the unit-test.
>>
>> You could probably lookup what the QTEST_MAIN macro does in Qt's c++
>> code and create similar code in python, but it might just as well be
>> easier to use an existing python unit-testing framework to drive your
>> tests. And the function to trigger signals or send events don't need the
>> QTestlib setup to be used.
>>
>> Andreas
>>
>> --
>> A visit to a fresh place will bring strange work.
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>
>
>
> --
> Ruslan Popov
> phone: +7 916 926 1205
> skype: rpopov
>
>


-- 
Ruslan Popov
phone: +7 916 926 1205
skype: rpopov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101017/18f0b40e/attachment.html>


More information about the PyQt mailing list