-
Notifications
You must be signed in to change notification settings - Fork 35
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
Make test generation pluggable #33
Comments
i think the as for how it should be passed into the test gathering code, i'm not sure. initially i was thinking that it would be nice to have some sort of generator/iterator class that could be walked at the time of testing. my reasoning for this is that if the generator code is large we might not want to pre-generate the entire test. this way if an early test fails it wouldn't be wasted effort generating the entire suite. |
Unfortunately one of the early design constraints in gabbi was that it work properly with the kinds of test discovery and reporting that's used in the belly of openstack ci. The main implication of that is that before any tests actually run they are all created. You can see this in the way that the load_tests method creates a suite of TestSuites. When being used with Does that mean an iterator that can be interrupted is not an option? No. Just that we need to be aware of the constraints that come about by being somewhat wed to testr+subunit and that failure handling is different depending on whether it is failure in creating a test or in running the test. Note: When I discovered all this (what felt like) chaos it was after coming from what felt like the much purer world of py.test and it made me shake my head. Alot. |
thanks for the clarification, there may not be a better way to do this than just create all the tests ahead of time. |
Now that we've made some refactorings in gabbi.driver the interface for this has become a bit simpler. What we need, essentially, is a callable that returns a list of dicts of the right structure:
argument handling would need to be resolved but the simplest thing is presumably some kind of iterator. This would replace the cuts of |
Commit 1b31ef0 extracted test making to the suitemaker module, so something could programmatically call |
While this is still entirely possible to do, at least theoretically, years of use have made me think that the key special value in gabbi is the syntax of the yaml files. It somehow manages to just work and feel good. |
total necro bump XD |
It ought to be possible to generate tests from something other than yaml files.
From IRC converations with @elmiko one idea was:
As discussed there this would likely require some adjustments to the flow of info through driver.py but the result would allow a lot of flexibility.
I reckon this should be post 1.0 because we don't want to be adding large features now.
Basically there would be a
TestSuiteGenerator
class with a sub class that is generate-from-yaml-files-dir that behaves as the current code. While it would be nice to preserve the build_tests signature, we don't have to make it that if the new signature was sufficiently powerful.Should a class be passed or an instantiated object or even a list of well-formed objects? As things stand now there is tight coupling between the gathering of the test data and the assembly of that data into tests cases. This could easily be two separate steps: Make the data, traverse it to make it into cases. The way it is now is simply the result of making the initial use case work.
(readers feel free to add comments with additional ideas)
The text was updated successfully, but these errors were encountered: