Skip to content

How to test your MPF game code

(You mean, other than taking it to a show to see what breaks?)

This is an incomplete placeholder, but here are the things to cover.

Help us write it!

This section is unwritten or needs an update or edit. Can you help write it? Get your name in lights and geeky pinball bragging rights! Hit the magic sparkly wand to the right of the title to see this page source on GitHub. Then add/edit and submit your change. It's easy!

You can write automated tests which "play" your game and look for bugs. These tests are pretty fun. They're basically a script that does something, then checks the state of something else. For example:

  • Do something: push start
  • Check for something: was a ball ejected out of the trough?

Or, to test a lane change feature.

  • Confirm that Lane 1 LED is on (or a certain color), and Lanes 2, 3, and 4 are off.
  • Hit the right flipper buttton
  • Confirm that Lane 2 LED is on (or a certain color), and Lanes 1, 3, and 4 are off.

Every time you add a feature or capability to your game, you should add a test. (Actually, there's a school of thought called Test Driven Developer / TDD which says you should write your tests before you implement a new feature. Obviously the tests will fail, but once they pass that means your feature is done!)

I can 100% guarantee that writing good tests will save you time in the long run AND it will make your game more stable. 2:36

Bonus: there are “fuzz” tests too which are just automated tests that hit all the switches randomly and make sure MPF doesn’t crash or hang. Good for beefing up your machine before you’re done, and something you should set up EARLY and run OFTEN so you don’t have surprises 2 days before a show

Consolidate this content to here:


Example tests:


Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results