![]() |
Music Example With Errors |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
We'll write the remainder of this page as if it were describing stories for the music player. We'll use italics when we want to point out features of the framework. You might as well run the example now before you continue reading. Browsing Music The music browser starts up looking at the whole library of songs. We specify the library (an advanced feature) so that we know what we are talking about in this document.
This is a the file that library reads. It is tab separated text. Try downloading it and looking at it with a spreadsheet. http:Release/Source/eg/music/Music.txt We can pick songs and see details of our selection as we go.
ActionFixture interprets the words in the first column. The actions operate on fields and buttons on the Browser screen we started in the first table. The Browser (or what ever other Fixtures we start) interprets the names in the second column. Each name maps to a method of the Browser. The third column provides data that are pass as arguments to Browser methods or compared with Browser method results. Playing Music Once we've picked a song, we can play it. We can continue operating the Brower while music is playing.
The Simulator is a Fixture that adds actions having to do with realtime operation of the music player. We call it a simulator because the application we are testing isn't a real music player. Our toy application cooperates with the simulator to keep track of time. A real player would do things that take real time and it would use the computer's realtime clock to keep track of time. We could still use a fixture with actions like pause and await but it wouldn't need to be a simulator too. Searching for Music There are buttons on the browser to find more songs like the one we have picked.
Our searches take a few seconds to complete. Eventually we will want to try mashing buttons faster than the computer can respond. For now we will be polite and await completion of our searches. The selected songs are displayed in a table.
Here we use Display (a RowFixture) to directly examine the Music object found by our search. Things like artist and track() are fields and methods of the domain objects. We can find songs related in different ways. Each new way produces a (possibly) different list of songs. Show all restores the display to the initial conditions.
Yielding the display:
Domain objects typically have lots more fields and methods than we can conveniently look at in a single table. We compose a table specific to our needs by choosing column headings of interest. Here is another look at the results of the previous search.
This completes the MusicExample. See the fixtures.
Now we consider some degenerate cases just to be sure that they work. Suppose we did not uniquely identify rows. We have two songs from JT. What happens when there are surplus (only one expected) ? When there are missing (three expelcted)?
We've run quite a few test. We'll call up one more Fixture that will add a summary to the end of our document.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Last edited October 6, 2002 Return to WelcomeVisitors |