Hi Sean, This is very valuable. Currently it is really hard to test GUI in Pharo. One problem I faced several times is that GUI are not uniformly managed: some GUI widgets use of exceptions (which is cool), some other are blocking the currently thread (which is not cool). For example, I can write: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | t | [self inform: 'blah'] on: Exception do: [:ex | t := ex ]. self assert: t messageText = 'blah' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Other cool tests: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= testSupplyAnswerOfFillInTheBlank self should: ['blue' = ([UIManager default request: 'Your favorite color?'] valueSupplyingAnswer: #('Your favorite color?' 'blue'))] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= However, not all widgets can be tested that way, which is quite problematic. For example, the following code opens a window, which is not one would expect: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= self should: ['/tmp' = ([UIManager default chooseDirectory] valueSupplyingAnswer: #('/tmp'))] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I am not sure how easy is to solve this problem, but this is something we need to work on. This is important. I opened an issue: http://code.google.com/p/pharo/issues/detail?id=5010 Cheers, Alexandre On 22 Nov 2011, at 20:27, Sean P. DeNigris wrote:
I'm starting to put together some helpers for UI testing. What's out there already?
I started simulating keyboard events. It seems like the place to hook is ActiveHand>>handleEvent:. This way, it will take into account the keyboard focus and route the event the way it would for a real event. Does that sound right?
So far the API adds TestCase>>simulateKeyStrokes: which forwards to ActiveHand>>handleEvent:, so you can put in a test: testMyMorph MyMorph new openInWorld. "MyMorph takes the keyboard focus in #initialize" self simulateKeyStrokes: 'abcd'. "keystrokes go to MyMorph instance"
Obviously, there are things missing (like modifier keys), but what are your thoughts on the general approach?
Sean
-- View this message in context: http://forum.world.st/GUI-Testing-Library-tp4097866p4097866.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.