[QA] Best practices for long scenarios in Cucumber?
Nikolas Everett
neverett at wikimedia.org
Tue Dec 17 22:04:31 UTC 2013
On Tue, Dec 17, 2013 at 4:51 PM, Chris McMahon <cmcmahon at wikimedia.org>wrote:
>
>
>
> On Tue, Dec 17, 2013 at 2:42 PM, Nikolas Everett <neverett at wikimedia.org>wrote:
>
>> On Tue, Dec 17, 2013 at 4:26 PM, Jeff Hall <jhall at wikimedia.org> wrote:
>>
>>> I want to create a browser test (for Visual Editor) that will repro a
>>> single continuous session where the user makes multiple edits to the same
>>> page. As I understand it, Cucumber "Scenarios" each equate to a new user
>>> session, which is not what I want, so the alternative seems to be to
>>> construct a long, continuous scenario like the following:
>>>
>>
>> The second two implementations are somewhat debated. Some cucumber folks
>> hate steps calling steps and some love it. I'm can see merit in both
>> arguments.
>>
>
> Nik is a master of this (and I learned from the CirrusSearch examples) but
> such things exist in the VE repo also:
> https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FVisualEditor/b922592902ad57f770b6810566b820aada74aa47/modules%2Fve-mw%2Ftest%2Fbrowser%2Ffeatures%2Fsupport%2Fhooks.rb
>
> What I did with VE was to make the tests that loop like that be runnable
> both with and without the REUSE_BROWSER env variable. When running locally
> I turn on REUSE_BROWSER, but as you know, Zelkjo objects to having
> REUSE_BROWSER in the production run, and I think those objections are worth
> considering.
>
> So bottom line might be to use a hook that is aware of the REUSE_BROWSER
> env var.
>
I wouldn't want REUSE_BROWSER on Jenkins. If you absolutely need to have
the something that spans lots of repeated actions I think it should be one
scenario. I use REUSE_BROWSER in cirrus really just as a speed hack more
than anything else.
For a scenario that really does need to do lots of edits over and over
again I'd go with a compound step. I wouldn't make the step have loops,
though, as that would ruin cucumber's error reporting. I abuse that enough
as it is....
Nik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20131217/25a366ad/attachment-0001.html>
More information about the QA
mailing list