Bugzilla – Attachment 36942 Details for
Bug 13849
Introduce acceptance tests with cucumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
scenarioNumberForTableDrivenScenarios. Keep track of the Scenario data array location to get data as HASH instead of ARRAY.
scenarioNumberForTableDrivenScenarios.txt (text/plain), 1.52 KB, created by
Olli-Antti Kivilahti
on 2015-03-17 10:14:27 UTC
(
hide
)
Description:
scenarioNumberForTableDrivenScenarios. Keep track of the Scenario data array location to get data as HASH instead of ARRAY.
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-03-17 10:14:27 UTC
Size:
1.52 KB
patch
obsolete
>=head scenarioNumberForTableDrivenScenarios >Maintains an internal scenario counter for scenarios which iterate over an ARRAY of example data. > >@PARAM1, String. The operation to perform, 'increment', to increment the scenario counter and return the new scenario number. > 'getdata', to get the given HASH of example values. > anything else, get the scenario number. >=cut > >sub scenarioNumberForTableDrivenScenarios { > my ($C, $operation) = @_; > > my $scenarioLineNumber = $C->{scenario}->{line}->{number}; #Scenarios line number is a good tell between various scenarios. > my $scenario = $C->{stash}->{feature}->{$scenarioLineNumber}; > unless (exists $scenario->{currentScenarioRepetition}) { > $scenario->{currentScenarioRepetition} = 0; > $C->{stash}->{feature}->{$scenarioLineNumber} = $scenario; > return $scenario->{currentScenarioRepetition} if ($operation eq 'increment'); #Prevent extra incrementations > } > > if ($operation eq 'increment') { > $scenario->{currentScenarioRepetition}++; #keep track of which scenario iteration we are currently at > } > elsif ($operation eq 'getdata') { > #Clone the data HASH, so we don't alter its contents. This might cause some awkward print notifications with pherkin. > my %data = %{$C->{scenario}->{data}->[ $scenario->{currentScenarioRepetition}-1 ]}; > return \%data; > } > return $scenario->{currentScenarioRepetition}; #Get the scenario iterations count. >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13849
:
36940
|
36942
|
37622
|
37678
|
39983
|
40070