Appendix C. Test Framework Examples

“There’s more than one way to skin a cat.”

Anonymous

There are many acceptance test frameworks. This appendix has a few examples for the application described in this book.


The Examples

These examples show how the tests in this book are expressed in different frameworks. The corresponding table-style tests are in Chapter 10, “User Story Breakup,” and Chapter 11, “System Boundary.” They all perform the following operations:

• Set up persistent storage with a customer and a CD.

• Check-out a CD.

• Check-in a CD with a simple rental fee computation.

• Verify the computation of the rental fee for an upcoming change in how rental fees are calculated, based on the CD category.

The Check-Out CD and Check-In CD tests are part of a workflow test. The Check-In test assumes that the CD has been checked-out. If the tests are run separately or not run in the required sequence, the setup would be performed for each test. Then the given part of the Check-In test has to ensure that the values for CD Data indicate that the CD is rented.


Fit Implementation

Here is the Fit version, which uses just the three original Fit table types. You can download the Fit version with the Java code from http://atdd.biz.

Setup

Check-Out CD

Check-In

Category-Based Rental Fees


Slim—Table Style

Here is the FitNesse version using Slim, created by Markus Gaertner. Some tables have been reformatted so they fit on the page. You can download this version with the Java code from http://atdd.biz.

Header

Setup

Check-Out CD

Check-In

Category-Based Rental Fees


Slim—Cucumber Style

Here is the Slim version created by Bob Martin. It gives an idea of what text-base tests look like. The text tests are connected to the scenario library. The scenario library in turn discusses methods written for a particular language.

Setup

Check-Out CD

Check-In CD

Scenario Library

Category-Based Rental Fees


Robot

Here is the Robot version created by Dale Emery. It is available at http://atdd.biz.

Setup

Check-Out CD

Check-In CD

Category-Based Rental Fees


Cucumber

Here is the Cucumber version created by John Goodsen.

Check-Out CD

Check-In CD

The previous scenario continues here:

Category-Based Rental Fees


Test Frameworks

To get more information about these and other common test frameworks, Table C.1 provides links. You can find other frameworks and tools at www.opensourcetesting.org/functional.php.

Table C.1. Some Acceptance Test Frameworks and Associated Links

image


Summary

• Tests can be implemented in a number of frameworks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.196.146