Just to say that Rajesh replied in the tracker issue, taking up my challenge. His re-working of my script was pretty good, and having seen it I realised that I could then do even better.
So, as part of MDL-48373 I found time to covert all the question Behat tests to the approved style. The real point of this post is to report on what I found.
What I was really doing was creating proper generators for questions, so you can say And the following "questions" exist: in the set-up for your scenario. This should make things faster than the old way of creating things through the Moodle UI.
On the other hand, splitting the existing long rambling tests into separate ones makes things slower, becuase we reset and repeat the initialisation more often.
Also, while working on these scripts I notices a few things were missed out in the testing, and added them.
So, overall, the run-time (for --tags core_question) has gone from
9 scenarios (9 passed)
288 steps (288 passed)
4m54.203s
to
28 scenarios (28 passed)
462 steps (462 passed)
7m5.508s
So, from 5 mins to 7 mins. . On the other hand, when something failes, you can just re-run that one specific test which is much shorter . Overall, I think the new tests are better.
So, I am starting to believe that 'Test one things per scenario' is not only desirable, but also possible.
However, I still think that if you are testing more than one things per scenario, you should be allowed to use more than one When and Then because it is much easier to read.