Checking a QTableWidget object against some test data

October 18th, 2007 by Frerich Raabe

A common problem when developing test scripts for Qt application is that some table should be checked for whether it contains the correct data. In particular, the expected data is stored in an external file and the test script should load the file and then compare its contents against the table cells. Here’s one way to do it, in Python:


def checkTableAgainstTestdata( tableName, testDataFileName ):
    table = findObject( tableName )
    dataset = testData.dataset( testDataFileName )  

    columns = table.columnCount
    rows = table.rowCount  

    testDataColumns = len( testData.fieldNames( dataset[ 0 ] ) )
    if columns != testDataColumns:
        test.fail( "Tables does not match test data",
                   "Table " + tableName + " has different number"
                   " of columns than test data in " + testDataFileName )  

    row = 0
    for idx in dataset:
        for col in range( 0, columns ):
            if col >= testDataColumns:
                break
            expectedText = testData.field( idx, col )
            tableText = table.item( row, col ).text()
            test.compare( expectedText, tableText )
        row += 1  

        if row >= rows:
            test.fail( "Tables does not match test data",
                       "Table " + tableName + " has different number"
                       " of rows than test data in " + testDataFileName )
            return  

    if row >= rows:
        test.fail( "Tables does not match test data",
                   "Table " + tableName + " has different number of"
                   " rows than test data in " + testDataFileName )
        return

The function simple takes the name of the table object to check as well as the name of the test data file. The test data file is expected to live in either the test cases “testdata” directory or in the shared testdata directory. A sample invocation might look like:


def main():
    tableName = "{type='QTableWidget' visible='1'}"
    testDataFileName = "expectedvalues.tsv"
    checkTableAgainstTestdata( tableName, testDataFileName )

Note that this doesn’t work for Qt3 QTable objects or with plain QTableView objects. For those, the API for aquiring the contents of a specific table cell is different. However, the algorithm of the function is the same.


				

Interview: Squish’s Advantages over QTP

October 10th, 2007 by Reginald Stadlbauer

Hi!

You can read an interview with one of our Squish for Java users on our web site.

It talkes about their test automation process and why they chose Squish over Mercury’s (now it’s actually HP) Quick Test Pro.

Returned from Redwood City

October 7th, 2007 by Harri Porten

We returned from the first of two Trolltech Developer Day’s events on Friday evening. There surely are many theories on how to best fight the jet lag but I dediced to simply do what my body asked for and gave in on any of the sudden urges to sleep that attacked me over the weekend.

London Heathrow airport was less crowded than during the summer but waiting lines were still long enough to be annoying and shortage of ground crew caused delays on take-off. I find it very much irresponsible of both airlines and airports to schedule more flights via a hub that it can obviously handle. Will try even harder next time to avoid this route.

The Silicon Valley stay itself was very much worth it. Met with several existing customers and prospects on their premises and at the conference. The exhibition area was well positioned with respect to the talks, meals and fresh air enabling an effective still relaxed contact with attendees. Our Qt programming quiz turned out to be more challenging than intended. The winner of the Nintendo DS Lite game console was drawn out of only five partipants that got it right!

Getting ready

September 25th, 2007 by Harri Porten

Same procedure as every year: we are preparing everything for our appearance at the Trolltech Developer Days in California and Munich, Germany. This year Frerich will join me for the trip to Redwood City and Rainer will go down to Munich with Reggie.

We’ll be conducting a quiz again. The prize will be a gaming device the winner can take home at the end of day two. Last year’s prime number riddle was way too easy so we made things a bit tougher this time. We decided to challenge the participant’s Qt knowledge a little bit. I say “a little bit” because we’ll use an eased version of the original. The first one didn’t pass internal testing with zero correct answers handed in.

As we are already travelling through the Bay Area we’ll use the opportunity to visit some of our customers on site to gather some feedback, demo new features and provide help. It’s nice to be able to get from one customer to another with only a few minutes car ride between. Frerich insisted on renting a Hummer for this purpose but I feared bad press giving the UN climate change convention that is taking place in New York right now.

Please drop by at our “booth”, say hello, take part in the quiz and grab one of those ultra-sweet gummi frogs we’ll have with us.

New office and the pains of moving

August 22nd, 2007 by Reginald Stadlbauer

Now that we have been in our new office for nearly 4 weeks we are finally sattled enough to find some time to write about it. In the last week of July we moved to nice and new offices. Due to our steady growth it got a bit too crowded in our old offices, so in spring we decided to move.

Since we moved into a new building we could get our offices set up exactly the way we wanted regarding room layout and interior. Basically we have 2-people offices for all developers since this turns out to be the most productive setup. The only exception are Harri and myself since we are on the phone a lot and it would be too disturbing sharing an office with somebody.

Since we have plenty of space (which hopefully will be filled soon – we are looking for software engineers!) we now have a nice library with a table football (foosball for the Americans :-) set up. It’s amazing how all of us are improving our “kicker” skills :-)

So all in all, we are really happy in our new office space. Photos will follow soon.

But now the pains: Surprisingly the move itself was rather smooth. But our telecom and internet provide screwed up biiiiiiiiig time. Our connection was supposed to get connected on July 30th. But they actually managed to not find our office building twice! You really must be blind or too stupid to read a map to not find it. Finally, after nearly two weeks we got the internet and phone connection.

The worst part is the incredibly bad customer service and that you just cannot do anything about it and are stuck in the annoying hotline.

So we really had to improvise a lot to get on-line in the first two weeks. I don’t even want to imagine what our customers would have said if we’d be off-line for a day :-)

To get to an end: Now all is set up and working well and we enjoy our new and productive environment :-)

Squish for Qt: Execute Shell-Like commands on Remote Host

August 16th, 2007 by Rainer Schmid

Important: The following information applies for Squish for Qt only.

Squish allows you to do remote testing with the squishrunner running on one host and squishserver (that starts your AUT) on another host. The script interpreter is living in the squishrunner process. So all script commands are executed on the first host and not on the second host that is running your AUT. Only Qt objects (and function you execute on them) are forwarded to the second host and are executed there.

So if you create e.g. a Python file object in your test script, you can only access the file system of the first host. But if you create a QFile object, you can actually access the file system of the second host. But for this to work, the AUT has to be running. And you need some knowledge of the Qt API.

In froglogic we use a dummy application that provides simple shell-like features that are actually executed on the remote host. So if you need such a functionality, read on to find out how to use this in your own test setting.

Read the rest of this entry »

Finalized return from aKademy

July 12th, 2007 by Harri Porten

This year’s KDE conference was again worthwhile going to. Wish I had been able to stay longer. Talks were good and seeing familiar and new faces proved to be very nice again. I might be in the minority but in my opinion the initial lack of an Internet connection was a good thing. It made people talk to each other or closely listen to a presentation rather than staring at their screen and using IRC to chat with people elsewhere or inside the same room.

Everything would have been perfect if I would not have to add three more people to the list of those that commenced their stay by filing a Property Irregularity Report at Glasgow Airport.

Read the rest of this entry »

Java Forum Stuttgart

July 6th, 2007 by Reginald Stadlbauer

Yesterday we attended the Java Forum Stuttgart (JFS), a Java conference organized by the Java User Group Stuttgart e.V. We had a booth there where we presented Squish and I also gave a talk.

Lately we have been to quite a few conferences. The JFS really was one of the best organized conferences we have been to. The attendees were really technical and automated GUI testing was of big interest. We got a lot of interest at our booth so that at times people had to wait while Frerich and I answered questions of other visitors. From the questions we got we could judge that our visitors had seriously thought about automated GUI testing before and real concrete interest.

I also gave a talk which was well attended as well and ended with many interesting and good questions.

I really also need to say a few words about the excellent organization. At my talk I was heartly welcomed, got help with the setup and a moderator introduced me to my audience. At other conferences I have been to, nobody from the origanizers was present at the talks and I as the presenter had to do everything myself which always feels a bit odd.

Also one thing I really appreciated was that there was a separate lunch for exhibitors before the official lunch for the visitors. Why is this so great? During the breaks (coffee, lunch, etc.) people walk the floor and visit the booths. So those are really the times where you HAVE to be at the booth. This means you usually get no chance to eat lunch during the lunch break because you are busy talking to visitors and the catering service removes anything eatable immediately after the break. So it was great to have a good and relaxed lunch for the first time and a conference :-)

In summary, it was a well-done conference and we’ll surely be there next year again.

Oh, and as it turns out, the taxi drivers in Stuttgart really like to talk a LOT. It was really entertaining but I also enjoyed the silence in the taxi we took back from the airport in Hamburg at the end of the day :-)

Carbon/Cocoa Inter Thread Communication

July 3rd, 2007 by Rainer Schmid

Apple has a nice overview of thread communication means in their multithreading documentation (for both, Carbon and Carbon). However, I think the documentation is missing another technique that is very simple.

Read the rest of this entry »

Squish for Qt: combine source and binary package

July 2nd, 2007 by Rainer Schmid

Squish for Qt is available as a binary package and a source package. The binary package is available for common platforms and compilers, but sometimes the Qt version you need is missing. Or maybe it is there, but it was built with a Qt configuration that does not match the Qt version you use in your project. In all these cases, you have to use the source package and build Squish yourself.

This might be hassle since you need to install the wanted scripting languages, e.g. This becomes even more of a problem if you want to build Squish on one machine and use the one build on many other machines (because the scripting languages have to be installed on that machine as well).

The advantage of the Squish binary package in this respect is that all is already packaged.

It becomes even worse if you are in the unlucky situation that you have to do a split build of Squish because your applications Qt version is that old that some parts of Squish does not support it (e.g. testing Qt 3.0 applications) or if your application is using a single-threaded Qt library.

So wouldn’t it be nice if you could just use the ease of installation of the binary package together with the flexibility of the source package? Well, you almost can.

Read the rest of this entry »