Menu

#1 Simple Table Processing

open
None
9
2005-12-22
2005-12-20
No

User Story: Simple Table Processing

Implement in EasyAccept the command expectTable.

The command expectTable is followed in the same line
by a list of column headers which define the table
that will be processed. Column headers are either
script commands corresponding to a Facade's method or
labels of values that will be passed as arguments to
those commands. A series of lines follows with cell
values for the table. The order chosen for the column
headers must match the order of values found in each
line. A cell in a column whose header is a Facade
method is treated as an expect using the cell value
and the Facade method, passing as arguments values
found in the columns whose headers are not Facade
methods. If these don't match with the method's
signature, an EasyAccept error is thrown. If a cell
value begins with an "!", the cell is processed as if
an expecterror were issued, using the string that
follows as an error message. The table processing
ends with a line containing "tableEnd".

Example: A table to check some properties of a
Monopoly game place in the board.

expectTable placeID getPlaceName getPlaceGroup
getPlaceOwner getPropertyRent getPlacePrice
1 "Mediterranean Avenue" purple bank 2 60
2 "Community Chest 1" chest !"This place can't be
owned" !"This place doesn't have a rent" !"This place
can't be sold"
3 "Baltic Avenue" purple bank 4 60
4 "Income Tax" tax !"This place can't be
owned" !"This place doesn't have a rent" !"This place
can't be sold"
5 "Reading Railroad" railroad bank !"This place
doesn't have a rent" 200
6 "Oriental Avenue" "light blue" bank 6 100
tableEnd

With the current EasyAccept implementation, the
preceding must be written like like this:

expect "Mediterranean Avenue" getPlaceName placeID=1
expect "purple" getPlaceGroup placeID=1
expect "bank" getPlaceOwner placeID=1
expect 2 getPropertyRent placeID=1
expect 60 getPlacePrice placeID=1

expect "Community Chest 1" getPlaceName placeID=2
expect "chest" getPlaceGroup placeID=2
expecterror "This place can't be owned" getPlaceOwner
placeID=2
expecterror "This place doesn't have a rent"
getPropertyRent placeID=2
expecterror "This place can't be sold" getPlacePrice
placeID=2

expect "Baltic Avenue" getPlaceName placeID=3
expect "purple" getPlaceGroup placeID=3
expect "bank" getPlaceOwner placeID=3
expect 4 getPropertyRent placeID=3
expect 60 getPlacePrice placeID=3

expect "Income Tax" getPlaceName placeID=4
expect "tax" getPlaceGroup placeID=4
expecterror "This place can't be owned" getPlaceOwner
placeID=4
expecterror "This place doesn't have a rent"
getPropertyRent placeID=4
expecterror "This place can't be sold" getPlacePrice
placeID=4

expect "Reading Railroad" getPlaceName placeID=5
expect "railroad" getPlaceGroup placeID=5
expect "bank" getPlaceOwner placeID=5
expecterror "This place doesn't have a rent"
getPropertyRent placeID=5
expect 200 getPlacePrice placeID=5

expect "Oriental Avenue" getPlaceName placeID=6
expect "light blue" getPlaceGroup placeID=6
expect "bank" getPlaceOwner placeID=6
expect 6 getPropertyRent placeID=6
expect 100 getPlacePrice placeID=6

Discussion

  • Osorio Abath

    Osorio Abath - 2005-12-20

    User story description with example

     
  • Eduardo Rebouças

    Logged In: YES
    user_id=1408611

    Please assign this request to me.

     
  • Osorio Abath

    Osorio Abath - 2005-12-22
    • assigned_to: nobody --> ereboucas
     
  • Marcell Barbacena

    Logged In: YES
    user_id=1251372

    Maybe would be better to especify a excel file, or a txt
    file with tab separated values, than to especify the table
    inside the easyaccept script itself.

    Example:
    expectTable(xls,"table.xls") placeID getPlaceName
    getPlaceGroup getPlaceOwner getPropertyRent getPlacePrice

    expectTable(csv,"table.txt") placeID getPlaceName
    getPlaceGroup getPlaceOwner getPropertyRent getPlacePrice

    expectTable(tsv,"table.txt") placeID getPlaceName
    getPlaceGroup getPlaceOwner getPropertyRent getPlacePrice

    where xls=excel file, csv=comma separated values, tsv=tab
    separated values.

     

Log in to post a comment.