Fuzz testing and CI with headless love

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Fuzz testing and CI with headless love

Post by technomancy »

Hi folks!

I haven't seen much talk about automated testing with Love, so I wrote a blog post about what I do in my game Bussard. It can be a bit tricky to figure out how to run a Love program in a headless environment for continuous integration, and since my game is open source I thought it might be helpful for others to learn from. I also have a neat (well, I think it's neat) setup for fuzz-testing (throwing random input at my program by inspecting the currently active key bindings) that might be useful for others. It's already found over a dozen bugs in my own codebase.

https://technomancy.us/180

Feedback welcome!

I also use the GitLab CI feature to continually run my tests (fuzz tests, regular tests, and luacheck linting) against git master and all incoming patches. It's really easy to set up and quite handy at helping people get into the habit of testing: https://gitlab.com/technomancy/bussard/pipelines
User avatar
Jack5500
Party member
Posts: 149
Joined: Wed Dec 07, 2011 8:38 pm
Location: Hamburg, Germany

Re: Fuzz testing and CI with headless love

Post by Jack5500 »

Wow, that looks great. Never thought about automated testing in Löve, but the way you set it up I could see it working for me as well. Thanks!
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

Re: Fuzz testing and CI with headless love

Post by technomancy »

Thanks! I think the key to making well-testable code is making your input handling work against a table of key bindings. If you're doing it in a declarative way, it's easier to automate.

Of course, it's questionable how helpful the fuzz testing would be in other games; my game is somewhat unusual since it embeds a multi-mode text editor and in-game Lua console. There are about 150 keybindings (with some redundancy) across all the different modes. Anyway, I had a lot of fun with it.
User avatar
Pangit
Party member
Posts: 148
Joined: Thu Jun 16, 2016 9:20 am

Re: Fuzz testing and CI with headless love

Post by Pangit »

That is a very impressive os - now all it needs is a text editor. Thanks for sharing your implementation of fuzz testing.

* sorry for the joke. I had to before someone else did.

Seriously though that is a great project. Very creative. :cool:
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Fuzz testing and CI with headless love

Post by davisdude »

technomancy wrote: [1] Yes, I know I just set myself up for the old "Bussard is a great OS, it just lacks a decent text editor" joke. Honestly I am just waiting for someone to come along and implement a vim mode in-game; if any player thinks they can do better than the built-in editor they are welcome to try!
Pangit wrote:That is a very impressive os - now all it needs is a text editor.
:rofl:

In all seriousness a Vim mode would be pretty cool if somebody would want to take that on... Interesting write-up
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 237 guests