form element ids and names and testing

Norbert Hartl norbert at hartl.name
Tue Jul 31 12:45:56 MEST 2007


Hi,

I'm a user of seaside testing. SeasideTesting provides two
methods for accessing form elements. It's by index and by
element id. Requesting by index is too error prone as the
change of the order of form elements breaks the test. 
Requesting by id is rendered impossible by using Magritte.
The ajaxId: stuff includes the hash of an object and is not
predictable when used inside a test.

I changed ajaxId: in MAComponent to use the following:

ajaxId: aSymbol
| accessor |
   ^ String streamContents: [
      :stream|	
      accessor := self description accessor.
      [ accessor respondsTo: #next ] whileTrue: [
         stream nextPutAll: accessor accessor readSelector.
         stream nextPut: $..
         accessor := accessor next
      ].
      stream nextPutAll: accessor readSelector.
   ].

This gives you the name of the selector as id and for nested
descriptions you get nestedObjectSelector.selector. Therefor
the ids per object are unique and are easily used in SeasideTesting.
But my colleague reminded me that this only works if I have a 
single form on the page. He said the id has to be unique across
the whole page. So my approach is bit critical. 

Is there anybody who uses SeasideTesting for testing magritte 
components? And if yes how do you do that?

thanks,

Norbert



More information about the smallwiki mailing list