Define ids for specs only once

There is a discovery run which defines ids for contexts/examples, after
that, the same id is given for each spec.
Improve isolation of discovery run

Separetes some functions into shared actions