0

I use squish-4.2.2 for testing GUI of our tool and use purecov.i386_linux2.7.3 for covering them. Our tools are based on qt-4.7.4_qsci version of QT. After building our tools in Purecov mode, when we run our tests, they fail if tests contain operation with "popsup menu". Purecov cannot generate the result *.pcv file. Also I would like to note that our tools do not fail when they are run without Squish, however "Popsup Menu" opens not earlier than after 30-60 seconds (in normal mode it is done during 1-2 seconds). So I have 2 issues: 1. when tests are run with Squish, they fail when tests contain operation with "Menu" item; 2. Purecov does not generate *.pcv file when tests fail.

I tried to find some interesting things on your site for resolving those problems, but I couldn't find anything related to my issues. In my opinion, Squish failed because when I try to open "Menu" item, GUI runs faster than its logic part, and after opening "Menu" item, Squish considers that operation is done and kills my tool.

Could you please tell me what I can do with my tests or tools for resolving those problems? Thanks.

Arto
  • 1
  • 2

1 Answers1

0

I had a similar issue in the past, with clicking menus from my app. I hope this helps you also!

Example: I wanted to open a "File" menu, followed by a sub-menu (which is pop-up) "New". When I'm in record mode of Squish, Squish records the following code in python:

activateItem(waitForObjectItem(":MainWindowForm.m_poMainMenu_QMenuBar", "File"))
activateItem(waitForObjectItem(":MainWindowForm.menuFile_QMenu", "New..."))

Now, this didn't worked all the time, honestly I didn't managed to understand why :). But, I found on their site, this a possible solution. So, I've replaced Symbolic names from the code above, and created a function that calls the objects after Real name properties:

def callMenu(menu_name, submenu_name):

    activateItem(waitForObjectItem("{type='QMenuBar' visible='true'}", menu_name))
    activateItem(waitForObjectItem("{type='QMenu' title='%s'}" % menu_name, submenu_name))

After I made this change, the tests run smooth, without anymore problems (at least from the menu side).

Eugen
  • 785
  • 6
  • 22
  • Thanks for answer, but my tools demonstrate strange behavior: Test work correctly with Pop-up Menu items (such as "File", "Edit", ...), but they failed when they meet Context menu item (when we done right click in some object) – Arto Mar 11 '16 at 12:48
  • I also note that our tests have written in Tcl, I tried to do something as you offered: proc callMenu {menu_name submenu_name} { set contextMenuName "{title='$menu_name' type='CPopupMenu' visible='true' unnamed='1'}" waitForObject $contextMenuName invoke type $contextMenuName $submenu_name } This works correctly in normal mode, but it failes again in Purecov mode – Arto Mar 12 '16 at 08:56