Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a library for generating test suites for a given state machine #2

Open
exarkun opened this issue Apr 17, 2014 · 1 comment
Open

Comments

@exarkun
Copy link
Member

exarkun commented Apr 17, 2014

Since the states are known and the inputs are known it's possible to generate a list of all of the possible scenarios that the state machine is supposed to handle. It's reasonable to say that each of these must have at least one unit test.

A library can generate a TestCase (or a mixin or something) that defines one test for each of these cases and gives them failing implementations that need to be overridden. This will give developers a very easy way to know the minimum set of tests they still haven't written.

Possibly there's a better interface than "a thing you can subclass" for this - but it's not immediately obvious to me since the way unittest works is pretty firmly "subclass this thing". (But... like... a class decorator maybe?)

@exarkun
Copy link
Member Author

exarkun commented May 15, 2014

Perhaps an alternative to subclassing is a class decorator which inspects the decorated class and adds new failing tests for any transitions that appear not to be tested. As with the subclassing idea, this would involve a particular naming convention for test methods so the decorator could accurately determine which cases had tests written for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant