intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Apr 23, 2018 10:29 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Nov 25, 2016 10:53 am 
Offline

Joined: Fri May 13, 2011 5:07 pm
Posts: 50
I'd like to know if anyone thinks it's possible to transform a string into a TADS 3 expression, or if the unit-testing idea below seems possible in some other way.

Question about transforming a string into a TADS 3 expression
When I say "transform a string into a TADS 3 expression," I mean, for example, if given the string "!redDoor.isOpen", does anyone think it would be feasible to create from this an expression that evaluates to either true or nil depending on whether the red door is closed?

Unit-testing idea
The reason I ask the above question is that, if it's feasible, it could provide a really awesome way of unit-testing games.

What I have in mind is the ability to write an "Assert" meta-verb that could be used for unit-testing as follows:

>OPEN RED DOOR
Opened.
>ASSERT "redDoor.isOpen"
True.
>CLOSE RED DOOR
That's not something you can close. [Bug.]
>ASSERT "!redDoor.isOpen"
False!
*** UNIT TEST FAILURE ***

I'm certain I couldn't develop this myself. I guess this is a question for whoever out there has written a TADS 3 compiler? Anyone?

Thanks,

Greg


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Nov 25, 2016 12:45 pm 
Offline

Joined: Sat Jul 16, 2011 3:48 pm
Posts: 278
Yes, this is perfectly possible, see http://tads.org/t3doc/doc/sysman/dynfunc.htm.

But as a side note - text adventure games are quite unique in comparison to traditional computer applications with graphical user interface in one aspect. All user interaction is plain text (typing on keyboard and reading on screen). When I was programming my own game few years ago I've used automatized testing heavily, in fact I've rarely played the game by myself interactively.

I've created really long list of commands to play the game, imagine a walk-through, but much longer doing every imaginable command which occurred to me or which my beta-testers tried out and then made a script which played the game and recorded screen output to a file. Next I've executed diff tool to compare actual output of game to last output considered bug free and displayed coloured differences - on one click compile, run test and display differences in game output. Think about it - instead of >ASSERT "redDoor.isOpen" just >x red door. When anything anytime changes you will see it in differences. When you are testing something which can be done five different ways you can use advantage of >undo command. Try one way, undo move and try the same other way and so on. In complex situation you can save position, do something and then load the old position back and continue testing.

Of course there are some rough edges such as random events, but still - with so little work (just few lines of shell scripting and then gradual walk-trough addition) you can get so great coverage of testing, which makes any attempt of unit testing as seen in traditional application development practices quite funny :-)


Attachments:
tads-automatic-testing.png
tads-automatic-testing.png [ 345.49 KiB | Viewed 472 times ]


Last edited by tomasb on Sat Nov 26, 2016 3:35 am, edited 2 times in total.
Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Nov 25, 2016 1:22 pm 
Offline

Joined: Fri May 13, 2011 5:07 pm
Posts: 50
Wow, that is awesome. I might just try that. It has been a long time since I looked at dynamic functions, and their value totally bounced off me at the time.

I like your other testing ideas too. Wish I'd thought of them earlier actually.

Thanks!

Greg


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group