Automated Testing

version 1/090116 by Roger Carbol

  • Home page
  • Beginning
  • Previous

  • Example: ** Testing the Waters 2 - Demonstrating a failed test.

        "Testing the Waters 2"

        Include Automated Testing by Roger Carbol.

        Use timer delay of at least 100.

        Chapter 1 - The Game

        The Cabin is a room. "The front of the small cabin is entirely occupied with navigational instruments, a radar display, and radios for calling back to shore. Along each side runs a bench with faded blue vinyl cushions, which can be lifted to reveal the storage space underneath. A glass case against the wall contains several fishing rods.Scratched windows offer a view of the surrounding bay, and there is a door south to the deck. A sign taped to one wall announces the menu of tours offered by the Yakutat Charter Boat Company."

        The Cabin contains a glass case. In the glass case is a collection of fishing rods.

        [I mistakenly assume that containers are closed by default...]

        The case is transparent, and openable.
        [The case is closed.]

        The bench is in the cabin. On the bench are some blue vinyl cushions.

        The bench is enterable.

        Chapter 2 - The Tests - Not for release

        Table of Scripts (continued)

        Verify Player Description is a test.
            The index of Verify Player Description is 1.
            The steps of Verify Player Description is the Table of Steps for Verify Player Description.

        Table of Steps for Verify Player Description
      order  command  response  
      1  "examine me"  "^As good\-looking as ever\.\n\n$"  
      2  "x myself"  "^As good\-looking as ever\.\n\n$"  

        Verify Rods-and-Case is a test.
            The index of Verify Rods-and-Case is 2.
            The steps of Verify Rods-and-Case is the Table of Steps for Verify Rods-and-Case.

        Table of Steps for Verify Rods-and-Case
      order  command  response  
      1  "take rods"  "^The glass case isn't open\.\n\n$"  
      2  "stop the test"  ".*"  
      2  "open case"  "^You open the glass case\.\n\n$"  
      3  "take rods"  "^Taken\.\n\n$"  
      4  "i"  "^You are carrying:.*a collection of fishing rods\n\n$"  

        [I've commented out the steps after the failure and added a "stop the test" to take a closer look.]

        test me with "assert all"

        test case with "assert Verify Rods-and-Case"