From: s g. <sgu...@ya...> - 2003-10-06 15:30:54
|
I guess I should have given you a better picture of what I really want to do. I've written a custom DocumentModel that does some complicated things, and keeps state, and fires events that other components are listening to, etc. In order to test the document model (or to user acceptance test it anyway), I was planning on putting it in text component (like a JTextField or something) and simulate typing in it. At each keystroke I could query other widgets in the form and make sure they are behaving properly. I want to be able to type a few characters and arrow around and tab and insert new characters and paste in text. select( 'component', 'text' ) seems like a nice short way to fill out forms and certainly has its place, but in this case I'm more interested in having fine grained control. I'm more interested in doing something like: keystroke( T ) # checkstate() keystroke( E ) # checkstate() keystroke( T ) # checkstate() keystroke( LEFT_ARROW ) # checkstate() keystroke( S ) # checkstate() I guess I could do something like: select( 'component', "t" ) # checkstate() keystroke( E ) select( 'component', "te" ) # checkstate() keystroke( T ) select( 'component', "tet" ) # checkstate() keystroke( LEFT_ARROW ) # checkstate() select( 'component', "test" ) # checkstate() but that doesn't test all of the code paths, and I'm pretty sure select( 'component', 'test' ) justn calls component.setText( "test" ). That's not really what I want to call in this case. (Although it is an aspect of my Document/Component that I want to test) Is this something marathon can handle (out of the box)? It sounds like I will probably need to add some extentions to get it to do what I want. Is this something that marathon wants to be able to do? Is this to fine grained for marathon? I'm not sure if it really fits in marathon's scope. TIA. -steven --- Brilly Tsang <bri...@ut...> wrote: > Hey Steven, > > To simulate user typing in a JTextComponent, you can > just entry the > information into the text field if you are using the > recorder. Marathon > only check the text on the component when it got a > focus lost and see if > there is any change. If there is, it'll record it. > > Keystroke is used to input special keys into the > textfield. I use it > for keystroke "enter" to trigger the default action > of a form > submission. You can also use keystroke to simulate > entries with control > keys like ctrl+C. > > The follow script is a demo that I ran marathon with > the default demo > application (can be run on command by: ant demo) > from sampleappfixture import * > > def test(): > window('Sample Dialog') > > #this modify the field > select('textField', 'testing testing 123') > click('Press Me') > > #this send a special key to the textfield > component > click('textField') > keystroke('Enter') > close() > > Cheers, > Brilly > > s guy wrote: > > >I would like to simulate a user typing in a > >JTextComponent. I tried the following script with > the > >demo that comes with marathon. > > > >------------------------------------------- > > > >from sampleappfixture import * > > > >def test(): > > window('Sample Dialog') > > select('textField', '') > > keystroke('A') > > assertText('textField', 'a') > > close() > > > >------------------------------------------- > > > >Should this work? From the documentation, I would > >expect keystroke() to forward keyEvents to the > >textfield. Is there something I'm missing? > > > >thanks, > >steven > > > >__________________________________ > >Do you Yahoo!? > >The New Yahoo! Shopping - with improved product > search > >http://shopping.yahoo.com > > > > > >------------------------------------------------------- > >This sf.net email is sponsored by:ThinkGeek > >Welcome to geek heaven. > >http://thinkgeek.com/sf > >_______________________________________________ > >Marathonman-devel mailing list > >Mar...@li... > >https://lists.sourceforge.net/lists/listinfo/marathonman-devel > > > > > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |