Testing jide grids with TestComplete

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Testing jide grids with TestComplete

Postby steverb » Thu Jan 28, 2010 10:02 am

Does anyone know of any problems related to testing jide grids with TestComplete? We are having trouble, and are working with the TestComplete vendor as well (AutomatedQA) but they are not familiar with jide components, so I thought I would ask here as also.

Basically, in a TestComplete script we can get a handle to any object, and can call methods on it to assert certain values are correct. You have access to the entire object model of the application you are testing. TestComplete supports writing scripts in several languages, but we are using VBScript currently. The code being tested is in Java (obviously). Here is a small sample:

Sub Test
Set shipmentTable = SwingObject("JScrollPane", "", 0).SwingObject("JViewport", "", 0).Shipment_table
Set shipmentModel = shipmentTable.getModel
Set cellValue = shipmentModel.getValueAt(2, 0)
Set cellStyle = shipmentModel.getCellStyleAt(2, 0)
End Sub

In our code, the Shipment_table is a com.jidesoft.grid.HierarchicalTable. The shipmentModel class extends AbstractTableModel (which is why we can call getValueAt) and it also implements StyleModel, which is why we can (or should be able to) call getCellStyleAt. We have implemented the method getCellStyleAt in our model, to make some cells have a different foreground color (red). In the test, we want to assert that the foreground color is correct for those cells.

In the script above, the call to getValueAt returns the correct value for that cell. But the call to getCellStyleAt returns nothing (an "empty object" is what TestComplete calls it) and the script fails.

Can anyone think of a reason why we would not be able to get a CellStyle object back? I know in the application code we never call GetCellStyleAt directly - it is only called by the renderer when cells are being painted. But I still don't know why we couldn't call it directly in our test.

Thanks for any help or ideas about this.
steverb
 
Posts: 2
Joined: Thu Jan 28, 2010 9:34 am

Re: Testing jide grids with TestComplete

Postby JIDE Support » Thu Jan 28, 2010 12:29 pm

Would you please try to invoke the same method while you are running your application and see if it works?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Testing jide grids with TestComplete

Postby steverb » Thu Jan 28, 2010 3:57 pm

That was a good suggestion - thank you! While trying to invoke the method, we discovered that our custom model had been wrapped inside a SortableTableModel, which in turn was wrapped inside a FilterableTableModel.

In our TestComplete script, we changed this line:

Set shipmentModel = shipmentTable.getModel

to

Set shipmentModel = shipmentTable.getModel.getActualModel.getActualModel

and everything worked great. Thanks again for pointing us in the right direction.
steverb
 
Posts: 2
Joined: Thu Jan 28, 2010 9:34 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 53 guests