History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: FKS-2
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Vivek Prahlad
Reporter: Irfan
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Frankenstein

adding assert_enabled threw an exception while running the test

Created: 05/Mar/07 11:56 PM   Updated: 14/Mar/07 11:11 PM
Component/s: Ruby driver
Affects Version/s: 0.7
Fix Version/s: 0.8

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Windows XP, Java 1.5


 Description  « Hide
the record and playback was working all fine.
when i added an assert_enabled
i got this error
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1444)
at com.thoughtworks.frankenstein.events.SelectListEvent.parameters(SelectListEvent.java:43)
at com.thoughtworks.frankenstein.ui.RecorderTableModel.getValueAt(RecorderTableModel.java:58)
at javax.swing.JTable.getValueAt(JTable.java:1771)
at javax.swing.JTable.prepareRenderer(JTable.java:3724)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:1149)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1051)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:974)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JViewport.paint(JViewport.java:722)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4787)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
at javax.swing.JComponent._paintImmediately(JComponent.java:4685)
at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

 All   Comments   Work Log   Change History      Sort Order:
Vivek Prahlad - 06/Mar/07 04:24 AM
It looks like the problem is caused due to a select_list event before the assert_enabled event. Could you post a portion of the test script with a couple of lines before and after the assert_enabled line?

George - 06/Mar/07 04:50 PM
Hi, this is the script:

activate_window "Portfolio Breakdown Selection Thu 25 Jan 2007"
edit_table_cell "JTable_2" , "0,1"
click_checkbox "2" , "false"
stop_table_edit "JTable_2"
assert_enabled "JTable_2"
edit_table_cell "JTable_2" , "0,1"
click_checkbox "2" , "true"
stop_table_edit "JTable_2"
assert_enabled "JTable_2"

When I remove the assert_enabled events, the script loads. However when I press play I get the following errors:

INFO: 03/07/2007 09:48:01 AM Playing: ActivateWindowEvent: Portfolio Breakdown Selection Thu 25 Jan 2007
INFO: 03/07/2007 09:48:01 AM Playing: EditTableCellEvent: Table: JTable_2 cell: (0,1)
INFO: 03/07/2007 09:48:01 AM Playing: CheckboxEvent: 2, selected: false
WARNING: 03/07/2007 09:48:01 AM Exception: Unable to find component with name: 2 in au.com.macquarie.fmg.des.trading.DimensionFrame[frame0,0,0,646x645,invalid,layout=java.awt.BorderLayout,title=Portfolio Breakdown Selection Thu 25 Jan 2007,normal,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,22,640x620,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=385,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
com.thoughtworks.frankenstein.playback.DefaultComponentFinder.findComponent(DefaultComponentFinder.java:35)
com.thoughtworks.frankenstein.events.CheckboxEvent.run(CheckboxEvent.java:48)
com.thoughtworks.frankenstein.events.EventExecutionStrategy$2.execute(EventExecutionStrategy.java:17)
com.thoughtworks.frankenstein.events.AbstractFrankensteinEvent.play(AbstractFrankensteinEvent.java:86)
com.thoughtworks.frankenstein.recorders.DefaultScriptContext.play(DefaultScriptContext.java:87)
com.thoughtworks.frankenstein.recorders.DefaultScriptContext.playEvents(DefaultScriptContext.java:80)
com.thoughtworks.frankenstein.recorders.DefaultScriptContext.play(DefaultScriptContext.java:69)
com.thoughtworks.frankenstein.recorders.DefaultRecorder.run(DefaultRecorder.java:101)
java.lang.Thread.run(Thread.java:534)

INFO: 03/07/2007 09:48:01 AM Playing: StopTableEditEvent: Table: JTable_2
INFO: 03/07/2007 09:48:01 AM Playing: EditTableCellEvent: Table: JTable_2 cell: (0,1)
INFO: 03/07/2007 09:48:01 AM Playing: CheckboxEvent: 2, selected: true
WARNING: 03/07/2007 09:48:01 AM Exception: Unable to find component with name: 2 in au.com.macquarie.fmg.des.trading.DimensionFrame[frame0,0,0,646x645,invalid,layout=java.awt.BorderLayout,title=Portfolio Breakdown Selection Thu 25 Jan 2007,normal,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,22,640x620,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=385,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
com.thoughtworks.frankenstein.playback.DefaultComponentFinder.findComponent(DefaultComponentFinder.java:35)
com.thoughtworks.frankenstein.events.CheckboxEvent.run(CheckboxEvent.java:48)
com.thoughtworks.frankenstein.events.EventExecutionStrategy$2.execute(EventExecutionStrategy.java:17)
com.thoughtworks.frankenstein.events.AbstractFrankensteinEvent.play(AbstractFrankensteinEvent.java:86)
com.thoughtworks.frankenstein.recorders.DefaultScriptContext.play(DefaultScriptContext.java:87)
com.thoughtworks.frankenstein.recorders.DefaultScriptContext.playEvents(DefaultScriptContext.java:80)
com.thoughtworks.frankenstein.recorders.DefaultScriptContext.play(DefaultScriptContext.java:69)
com.thoughtworks.frankenstein.recorders.DefaultRecorder.run(DefaultRecorder.java:101)
java.lang.Thread.run(Thread.java:534)

INFO: 03/07/2007 09:48:02 AM Playing: StopTableEditEvent: Table: JTable_2

Also, I dont have ruby installed. All I have done is add the Frankenstein jars into the classpath.

Vivek Prahlad - 06/Mar/07 09:48 PM
Thanks, George. It looks like there are two separate issues.

a) I would strongly recommend running those steps via the ruby driver. The ruby folder contains an example.rb file that shows how to put a test together in Runy. The assert_enabled API has to be executed from the Ruby side. Most assertions are converted to an intermediate OGNL form that the java runtime can understand.

Here's a workaround: replace

assert_enabled "JTable_2" with
assert "JTable_2" "enabled:true" (This is the OGNL expression that the Frankenstein Java runtime receives from from the Ruby driver when the assert_enabled function is called)

b) The exception you're seeing is a bug, I'm taking a look at it right now.

Vivek Prahlad - 06/Mar/07 10:54 PM
I've got a potential fix for the second issue checked into subversion. There's a change that will allow checkboxes within tables to be named in a better way. When you record your script, the check box click step should now show up as
click_checkbox "<column_name_without_spaces>", "true" instead of
click_checkbox "<1/2/3/etc.>", "true"

Could you please check whether this works for you? In case you'd rather wait for a release, I'm planning the next release for early next week.

Vivek Prahlad - 14/Mar/07 11:11 PM
Fixed, please reopen in case the fix doesn't work for you.