assert-based testing for TADS3/ADV3LITE

Hi all,

Hopefully, I categorized this correctly. I have been using for some time adv3lite/tads3 for making simple games for the family. (And thanks to Eric Eve for his hard work on getting that done plus making it easy to pick it up by THOROUGHLY documenting it.) But I have one small beef: writing tests (using the class Test), while a good idea, do not work well or work at all when you daisy-chain them. Rather than discuss all of the limitations, the purpose of this new class is to test that a sequences of operations in your game code result in the expected outcomes by programmatically testing those outcomes are correct (including displayed text). As your game evolves, you can check you did not break something else automatically.

  • Builds off of Test that allowed one to purloin objects and gonear the room to start each test, followed by a list of commands.
  • Each test can now be independent of each other with flags for resetting the game state back to when the test started or even restarting the game before the test executes; especially useful with Tests spread across multiple files.
  • Offers a number of assertions (in the list of commands) that must pass or the assert fails and then the test fails with a message, including a variation that allows you to confirm that a given phrase appeared on the console after the previous command(s) was/were executed.
  • Run all tests with the ability to stop on first failing test or run through all of them and give a summary of results (# of tests, # of assertions, # of assertions that failed).

If anyone thinks this would be helpful, I just need to know where to upload this small tads file along with its short doc.

3 Likes

Eric has just solved a similar problem involving scenes; perhaps the issue you noted also has a similiar solution ?

a look at the recent diffs on Adv3Lite github page perhaps can be insightful on how to solve your issue ? :slight_smile:

Best regards from Italy,
dott. Piergiorgio.

Thanks. I guess my message was poorly worded. I already solved the problem and was offering it up if someone else wants it. I took a look and am not seeing anything new for assertion-based testing in the latest adv3lite library.

2 Likes

I’d be interested in this. I use the Test command all the time.

Do you know where I can upload this?

If it isn’t a very big file, you can copy and paste in your reply. Just tag it with the code tag </>. I think it is called preformatted text or you can use Option E. See below:

bedroom: Room 'Bedroom'
"Your bed lurks in one corner, the clothes a heap from a
restless night. The only way out is to the east. "
;

Otherwise, you can zip it into a file and upload in your reply. That may depend on how long you’ve been a member.

I had a “duh” moment and realized that the best is to create a github repo. Hopefully this works for you.

1 Like