How to write good test suites for Ren'Py games?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
SoGu
Newbie
Posts: 6
Joined: Wed Aug 10, 2016 12:40 pm
Contact:

How to write good test suites for Ren'Py games?

#1 Post by SoGu » Wed Jan 25, 2017 7:55 am

I'm currently writing a framework for creating Ren'Py games based on character personality models. This framework consists of several small Python scripts (and is still supposed to grow). I really want to test everything properly, because the framework's complexity is quite ugly for such a small script.

However, I don't know how to tackle this testing. Most important for me would be unit tests. Probably making a test "game" with a start label and letting lots of small tests run would be possible but time-consuming. Is there an elegant way of automating test execution? Fast-forwarding could work well, I guess, but only if there is an easy way of interrupting fast-forwarding when a test case fails.

Has anyone else had a similar problem or an idea how unit-testing within Ren'Py could be solved in the most elegant way?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to write good test suites for Ren'Py games?

#2 Post by PyTom » Thu Jan 26, 2017 2:49 pm

One way to do this would be to isolate out the python code, and test it separately from the Ren'Py interface. There's also a Ren'Py testcase language, although it's more for testing gui code than logic - you can see it in testcases.rpy in the launcher/game and tutorial/game directories of recent Ren'Pys.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: How to write good test suites for Ren'Py games?

#3 Post by Apa » Sat Jan 28, 2017 12:42 am

SoGu wrote:Has anyone else had a similar problem or an idea how unit-testing within Ren'Py could be solved in the most elegant way?
Could you give a few examples of such tests (with as success and failure outcomes), please?

The only test I can think about is “game logic test” at very high level:
Get all labels, make graph and find unreachable [groups of] nodes (aka garbage collector test)
Tho, it’s not any easy to do because of jumps/calls to dynamic (calculated at run-time) labels, so some sort of hints might be needed.

Another idea is an "automated game walker" to traverse all/chosen path from start/save point, so you don’t have to click anything, but only watch (to fix a bug at specific game stage). Not sure how usable it’ll be either. :oops:

I don’t have any more ideas as of now...

Post Reply

Who is online

Users browsing this forum: No registered users