Automated Testing: Difference between revisions
From IFWiki
No edit summary |
(Added to Category:Testing) |
||
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Image:Automated Testing small cover.jpg|right]] '''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== | |||
* For [[Glulx]] only. | |||
* Uses [[Text Capture]] by [[Eric Eve]]. | |||
* Uses [[Glulx Text Effects]] by [[Emily Short]]. | |||
==Notable Features== | ==Notable Features== | ||
Line 15: | Line 15: | ||
This sort of automated testing could be used for test-driven development. | This sort of automated testing could be used for test-driven development. | ||
==Code | ==Sample Code== | ||
<pre> | |||
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$" | |||
</pre> | |||
==Sample Transcript== | |||
<pre> | |||
>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 | |||
</pre> | |||
==Versions== | ==Versions== | ||
* version 1/090116 by [[Roger Carbol]]. | |||
==Links== | ==Links== | ||
* [http://inform7.com/extensions/Roger%20Carbol/Automated%20Testing/index.html Automated Testing] at the [[Inform 7]] site. | |||
* [http://inform7.com/extensions/Roger%20Carbol/Automated%20Testing/index.html | ** [http://inform7.com/extensions/Roger%20Carbol/Automated%20Testing/Automated%20Testing.i7x Download this extension]. | ||
** [http://inform7.com/extensions/Roger%20Carbol/Automated%20Testing/doc_0.html View its documentation]. | |||
{{game | ** [http://inform7.com/extensions/Roger%20Carbol/Automated%20Testing/source.html View its source code]. | ||
* {{ifdb game|Automated Testing|7ih90fl0hr5vrpfq}} | |||
[[Category:Inform 7 extensions]] | |||
[[Category:Testing]] |
Latest revision as of 13:20, 28 October 2010
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
- For Glulx only.
- Uses Text Capture by Eric Eve.
- Uses Glulx Text Effects by Emily Short.
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
- version 1/090116 by Roger Carbol.