wei wei
2008-Oct-14 16:30 UTC
[rspec-users] [cucumber] Is it possbile to access scenario name in steps?
One of my examples now is like below
### case_1001.feature
Feature: case_1001
Scenario: 10001
Given the network is CBS
Given the data :
Then there should be an asset with internal id and title1 in DB
--
Wei Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/rspec-users/attachments/20081015/8d8f021a/attachment.html>
wei wei
2008-Oct-14 16:40 UTC
[rspec-users] [cucumber] Is it possbile to access scenario name in steps?
One of my examples now is like below
### 1001.feature
Feature: 1001
1001 is the internal id for QAs to identify case
Scenario: 1001
Given the title is "function1_1001"
.....
### function1.steps
Given /the title is "(.*)"/ do |title|
@title = title
end
Actually the title is generated by the rule
"function1_#{scenario_name}". So
ideally it could be written in this way
### 1001.feature
Feature: 1001
1001 is the internal id for QAs to identify case
Scenario: 1001
Given the generated title
.....
### function1.steps
Given /the generated title/ do
@title = "function1_#{@scenario_name}" #though the variable
@scenario_name
isn''t available
end
So my question is: is it possible to get the name of the scenario/feature in
the step block?
ps: sorry, last message was sent by mistake.
--
Wei Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/rspec-users/attachments/20081015/3e870bc7/attachment-0001.html>
aslak hellesoy
2008-Oct-14 19:23 UTC
[rspec-users] [cucumber] Is it possbile to access scenario name in steps?
On Tue, Oct 14, 2008 at 6:40 PM, wei wei <weiwei9 at gmail.com> wrote:> One of my examples now is like below > ### 1001.feature > Feature: 1001 > 1001 is the internal id for QAs to identify case > Scenario: 1001 > Given the title is "function1_1001" > ..... > ### function1.steps > Given /the title is "(.*)"/ do |title| > @title = title > end > Actually the title is generated by the rule "function1_#{scenario_name}". So > ideally it could be written in this way > ### 1001.feature > Feature: 1001 > 1001 is the internal id for QAs to identify case > Scenario: 1001 > Given the generated title > ..... > ### function1.steps > Given /the generated title/ do > @title = "function1_#{@scenario_name}" #though the variable @scenario_name > isn''t available > endPlease try to exclude irrelevant information when asking a question. Everything you said above doesn''t make your question any clearer.> So my question is: is it possible to get the name of the scenario/feature in > the step block?It''s not, but you can register a feature request. Take a look at http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/44 It sounds like what you''re asking for is related. Aslak> ps: sorry, last message was sent by mistake. > -- > Wei Wei > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >