Camp Smalltalk: Day Two
Well, I'm working on the HttpUnitTest and we solidified the language to use for querying the html structure. I took a lot of inspiration from Seaside. I wanted something that was as concise as its html generation framework. I think we have achieved that very nicely. Here's an example for one of our tests:
self assert: (browser h1 allSatisfy: [:each | each text = '0']).
self assert: (browser a text includesAllOf: #('++' '--')).
self assert: ((browser id: 'counterValue') anySatisfy: [:each | each text = '0']).
This tests the code from the Seaside counter example. In the first example, I find all of the h1 elements currently shown in the browser object satisfy that their text is zero. The browse object pretends to be just that and is used for navigation. So, if I want to do a simple cick of a link I write the following:
browser clickLink: [:a | a text = '++'].
This code will find all "a href" elements and send it to the block and the first element that satisfies the block rule will be the link that we click on.
Today, we're going to add support for forms and more complicated navigation.
On a side note, we took a road trip Powell's bookstore and I had a blast! So many books, it makes your headspin. I bought three books (how can you escape a bookstore so large and buy no books?!).
Lastly, good and stimulating conversations have abounded. I am with true brothers. I can't express how proud I am to be a part of Smalltalkville this week. I am truly riding on the shoulders of giants this week.
Wednesday, July 21, 2004
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment