Automated Testing

From IFWiki

Automated Testing small cover.jpg

Automated Testing by Roger Carbol is an Inform 7 library extension. It allows the author to create and run automated tests, which could be used for test-driven development.

Requirements and Restrictions

Notable Features

Automated Testing allows the author to create and run automated tests.

The test scripts are stored as rows of tables that belong to test objects. These scripts specify a number of parser commands, such as "examine me", and the corresponding response expected from the game, such as "As good-looking as ever."

They are automated in that the author can quickly execute all defined test scripts and receive a report on which passed and which failed. The virtual machine is restarted between tests.

This sort of automated testing could be used for test-driven development.

Sample Code

    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$"   

Sample Transcript

>ASSERT ALL

[...]

∙ success: 1 Verify Player Description, step 1
∙ success: 1 Verify Player Description, step 2
∙ success: 2 Verify Cabin Description, step 1
∙ success: 3 Verify Rods-and-Case, step 1
# FAIL: 3 Verify Rods-and-Case, step 2
∙ success: 3 Verify Rods-and-Case, step 3
∙ success: 3 Verify Rods-and-Case, step 4

Versions

Links