Music Example With Errors



In this example we describe a music player as if we were operating it. This is an intentionally corrupted version of the MusicExample that shows how various errors are reported.

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.

fit.ActionFixture
start eg.music.Browser  
enter library Source/eg/music/Music.txt
check total songs 37

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.

fit.ActionFixture
enter select 1
check title Akila
check artist Toure Kunda
enter select 2
check title American Tango
check artist Weather Report
check album Mysterious Traveller
check year 1975 expected
1974 actual
check time 3.70
check track 2 of 7

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.

eg.music.Simulator time split
press play   01:03:38 1.2
check status loading 01:03:39
pause 2   01:03:39 2.0
check status playing expected
loading actual
01:03:41
pause 2   01:03:41 2.0
check status playing 01:03:43
check time 3.70 01:03:43
press pause   01:03:43 1.2
check status pause 01:03:44
check remaining 3.66 01:03:44
pause 60   01:03:44 60.0
check remaining 3.66 01:04:44
press play   01:04:44 1.2
check status playing 01:04:45
pause 60   01:04:45 60.0
check remaining 2.66 01:05:45
await play complete   01:05:45 159.3
check status ready 01:08:24

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.

eg.music.Simulator time split
press same album   01:08:24 1.2
check status searching 01:08:26
await search complete   01:08:26 1.1
check status ready 01:08:27
check selected songs 2 01:08:27

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.

eg.music.Display
title artist album year time() track()
Scarlet Woman Weather Report Mysterious Traveller 1974 5.72 6 of 7
American Tango Weather Report Mysterious Traveller 1974 3.70 2 of 7

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.

eg.music.Simulator time split
press show all   01:08:27 1.2
check selected songs 37 01:08:28
enter select 3 01:08:28
check artist James Taylor 01:08:29
press same artist   01:08:29 1.2
check selected songs 5 01:08:30

Yielding the display:

eg.music.Display
title artist album year time() track()
Handy Man James Taylor JT 1977 3.30 7 of 12
Scarlet Woman missing Weather Report Mysterious Traveller 1974 5.72 6 of 7
Sailing To Philadelphia James Taylor October Rose 2000 expected
2001 actual
5.47 3 of 3
Ananas James Taylor Hourglass 1997 5.73 5 of 13
Another Gray Morning missing James Taylor JT 1977 2.73 4 of 12
Copperline surplus James Taylor New Moon Shine 1991 4.37 1 of 12
Another Grey Morning surplus James Taylor JT 1977 2.73 4 of 12

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.

eg.music.Display
title album genre size date
Another Grey Morning JT Pop 3284199 9/7/02 11:32 PM
Ananas Hourglass Pop 6897450 9/7/02 11:47 PM
Copperline New Moon Shine Pop 5248087 9/7/02 9:52 PM
Handy Man JT Pop 3976956 9/7/02 11:36 PM
Sailing To Philadelphia surplus October Rose Pop 6581911 Sat Sep 07 22:45:00 PDT 2002

This completes the MusicExample.


See the fixtures.

See the application.


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)?

eg.music.Display
album genre
October Rose Pop
Hourglass Pop
New Moon Shine Pop
JT Pop
JT surplus Pop

eg.music.Display
album genre
JT Pop
October Rose Pop
JT Pop
Hourglass Pop
JT missing Pop
New Moon Shine Pop


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.

fit.Summary
counts 90 right, 10 wrong, 0 ignored, 0 exceptions
input file /Users/ward/fit/Release/Documents/MusicExampleWithErrors.html
input update Mon Oct 07 00:27:58 PDT 2002
output file /Users/ward/fit/Release/Reports/MusicExampleWithErrors.html
run date Mon Oct 07 01:03:37 PDT 2002

 

Last edited October 6, 2002
Return to WelcomeVisitors