Section 28.6. DoFixture in General


28.6. DoFixture in General

When it is a DoFixture, the fixture object of the first table interprets the rest of the tables in a special way. For each table, it considers the first row as follows.

  • If the row contains an action, a call is made to the corresponding method in the flow fixture object or system under test and any result returned.

    If the method returns a boolean, the following apply.

    If the value is TRue, the action is colored green in the table.

    If the result is false, the action is colored red.

    Otherwise, if an exception is thrown, the action is colored yellow, with an error message.

  • If the row contains one of the following special actions, no result is returned.

    check compares the expected value in the last cell of the row against the result of the action in the rest of the row. As with the check in ActionFixture, the cell containing the expected result is colored red, green, or yellow, depending on the match. Unlike check in ActionFixture, "error" is not supported as an expected result; the special action reject is used instead.

    reject carries out the action in the rest of the row. If the action would have been colored green, the reject cell is colored red. If the action would have been colored red or yellow, the reject cell is colored green.

    not is the same as reject.

    note ignores the rest of the row. This action is for including comments in DoFixture tables.

    show carries out the action in the rest of the row, showing the result of the action in a cell that's added to the row. If the result contains HTML, it will rendered as HTML in the report.

    calculate returns a CalculateFixture applied to the same system under test as the current DoFixture.

  • The row refers to a property of the flow fixture object or of the system under test. This property is accessed through its getter method, such as getName(), and any result returned. If the result is a boolean, coloring occurs as for actions.

  • The row contains the name of a fixture. An object of that class is returned. This means that a DoFixture table may be used to start a sequence of tables that are interpreted in the usual manner.

The interpretation of the rest of the table depends on the result returned from processing the previous row.

  • If there is no result or if the result is a primitive value, such as an int, the current DoFixture object handles the rest of the table. This will usually be the flow fixture object but may be a new DoFixture that was introduced in a previous row of the same table.

  • If a Set is to be returned, it is wrapped in a SetFixture, which is returned instead.

  • If any other Collection or a Map, Iterator, or Object[] is to be returned, it is wrapped in an ArrayFixture, which is returned instead.

  • If any other Object is to be returned, it is wrapped in a DoFixture, which is returned instead.

  • If a fixture is returned, it is used to interpret the rest of the table. However, the next table is interpreted independently, using the flow fixture object.

Note

Flow style means that, with the use of a flow fixture object, the reference to the system under test does not need to be a public static variable, because it does not need to be accessed as a global variable from other fixture objects, as is the case with the core fixtures. Instead, any object references can be passed to a new fixture object when it is created in a method of the flow fixture object that is carrying out a DoFixture action.




    Fit for Developing Software. Framework for Integrated Tests
    Fit for Developing Software: Framework for Integrated Tests
    ISBN: 0321269349
    EAN: 2147483647
    Year: 2005
    Pages: 331

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net