byexamples / byexamples/byexample
Autoinject code? Coverage/performance/others simplification
- Dominant language
- Python
- Stars
- 67
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the feature you'd like**
`byexample` allows to run arbitrary code at some points during the execution. These *hooks points* are described in the `Concern` interface.
One use case for these *concerns/hooks* is to enable coverage: the coverage system is initialized at the begin of the execution and at the end it generates a dump with the stats.
An example of this is the [coverage.py](https://github.com/byexamples/byexample/blob/91fb6b3915e9e88b44a047e8c030b89d05890db6/test/coverage.py) of `byexample`.
Other cases could be:
- enabling measure of performance for the whole execution or per example
- enabling debug logs
These are the *orthogonal* things for what `Concern` was designed for.
But creating a `Concern subclass`, implement some of its methods in Python it may be to complex, specially for people coming from other languages.
It could be much nicer just say:
```ruby
byexample -l ruby --enable-ruby-coverage
```
But that is perhaps too much for `byexample`.
A tradeoff could be:
```ruby
byexample -l ruby --inject "ruby:begin:" --inject "ruby:end:"
```
More cryptic, sure, but more general too: `byexample` could inject a *ruby file* at the begin and at the end of the execution.
`byexample` doesn't need to know about coverage/performance/debug/etc and the user doesn't need to know about Python and the `Concern` interface.
Contributor guide
Assessment
This issue has not been assessed yet.