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?
How to write good test suites for Ren'Py games?
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.
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.
- 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?
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(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
Re: How to write good test suites for Ren'Py games?
Could you give a few examples of such tests (with as success and failure outcomes), please?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?
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.
I don’t have any more ideas as of now...
Who is online
Users browsing this forum: No registered users