2011-06-07 9 views
14

नहीं हैं I मुझे एक रेल (3) ऐप मिला है और मौजूदा ककड़ी परीक्षणों के साथ पकड़ने की कोशिश कर रहा हूं। मैं एप्लिकेशन की 'सुविधाओं' फ़ोल्डर में निम्नलिखित सेटअप मिल गया है (मैं बाहर नहीं छूटा है किसी भी फाइल जो प्रासंगिक नहीं हैं, जैसे अतिरिक्त सुविधाओं और कदम)"रेक" मेरे सभी ककड़ी परीक्षणों को ठीक करता है लेकिन "ककड़ी" में

/features 
    /people 
    new-person.feature 
    /step_definitions 
    people_steps.rb 
    web_steps.rb 
    /support 
    env.rb 
    paths.rb 
    selectors.rb 

अगर मैं 'रेक' रन तो इसे चलाता step_definitions में सूचीबद्ध चरणों का सही उपयोग करके सुविधाओं/लोगों/नए व्यक्ति.फेचर में सभी सुविधाएं।

हालांकि, मैं हर बार रेक चलाने के लिए नहीं चाहता क्योंकि यह बहुत लंबा लगता है, मैं सिर्फ ककड़ी में एक विशिष्ट परीक्षण चलाने के लिए चाहता हूं, उदाहरण के लिए cucumber features/people/new-person.feature -l 8

जब मैं ऐसा करता हूं, तो यह सुविधा चलाता है लेकिन चरणों को लोड नहीं करता है। मुझे यह वापस मिल गया:

Using the default profile... 
Feature: Add a new person 
    In order to allocate tasks to people 
    As a community manager 
    I want to add a new person 

    Scenario: Secondary navigation should contain "Add new person" # features/people/new-person.feature:8 
    Given I am on the new person page       # features/people/new-person.feature:9 
     Undefined step: "I am on the new person page" (Cucumber::Undefined) 
     features/people/new-person.feature:9:in `Given I am on the new person page' 
    Then I should not see "Add new person"      # features/people/new-person.feature:10 
     Undefined step: "I should not see "Add new person"" (Cucumber::Undefined) 
     features/people/new-person.feature:10:in `Then I should not see "Add new person"' 

1 scenario (1 undefined) 
2 steps (2 undefined) 
0m0.005s 

You can implement step definitions for undefined steps with these snippets: 

Given /^I am on the new person page$/ do 
    pending # express the regexp above with the code you wish you had 
end 

Then /^I should not see "([^"]*)"$/ do |arg1| 
    pending # express the regexp above with the code you wish you had 
end 

If you want snippets in a different programming language, just make sure a file 
with the appropriate file extension exists where cucumber looks for step definitions. 

ककड़ी क्यों चरणों को लोड नहीं कर रहा है? मुझे लगता है कि मुझे कहीं भी कदमों की आवश्यकता है लेकिन मैं कहां काम नहीं कर सकता।

धन्यवाद, मैक्स

+0

के लिए तर्क की खाति फीचर फ़ाइल को एक निर्देशिका में ले जाती है। मुझे अपनी विभिन्न। फीचर फाइलों में कहीं भी आवश्यकता नहीं है, और मुझे इस बात को इंगित करने वाली सुविधाओं/समर्थन/फ़ाइलों में कोई कॉन्फ़िगरेशन गोप नहीं दिखाई देता है। क्या आप निश्चित हैं कि आपके लोग_स्टेप.आरबी कोड कार्यात्मक हैं? क्या आपने अभी तक एक चिकन बलिदान दिया है? – jaydel

+0

@jaydel - यह सब ठीक काम करता है जब मैं इसे 'रेक' के साथ चलाता हूं, यानी सभी चरणों को ठीक से लोड किया जाता है। मैं समझदार समूहों में उन्हें व्यवस्थित करने के लिए सिर्फ अपनी विशेषताओं को उप-देना जारी रखना चाहता हूं। –

+0

@jaydel - लेकिन, फीचर फ़ाइलों को मुख्य विशेषताएं फ़ोल्डर में ले जाने से समस्या ठीक हो गई है ... कहीं और आवश्यकता होनी चाहिए कि मुझे एक अतिरिक्त "../" जोड़ने की आवश्यकता है। –

उत्तर

11

मैक्स विलियम्स ने अपने सवाल का जवाब मिल गया:

संपादित करें - जवाब है, मिली: https://rspec.lighthouseapp.com/projects/16211/tickets/401-envrb-not-loaded-when-running-individual-features-in-sub-directories

config में/cucumber.yml वहाँ एक लाइन है कि इस तरह दिखाई देता है :

std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags [email protected]"

के लिए यह परिवर्तन 210

std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags [email protected] --require features/"

यह आपके ककड़ी परीक्षण चालन के अंत तक --require features/ जोड़ने की तरह है और यह सब कुछ लोड ठीक से बना देता है।

+0

धन्यवाद सेबेस्टियन :) –

+0

@ मैक्स, आपको यह जवाब स्वीकार करना चाहिए। – nessur

+0

भी, यदि आप डिफ़ॉल्ट विकल्प नहीं जोड़ना चाहते हैं, तो आप इसे चलाने के दौरान केवल '-r विशेषताएं /' को ककड़ी में जोड़ सकते हैं। – nessur

0

मेरे पास पहले से ही cucumber.yml फ़ाइल को बदलने के लिए पहले से ही नहीं था, किसी भी कारण से। तो, बस एक खाली /config/cucumber.yml फ़ाइल बनाना और इसमें लाइन डालना:

std_opts = "--format # {ENV ['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~ @ wip --require विशेषताएं/"

काम नहीं किया। (यही कारण है, मैं समझ वहाँ सिर्फ इतना है कि एक लाइन की तुलना में यह करने के लिए अधिक होना चाहिए था आश्चर्य की बात नहीं है।)

मैं एक पूर्ण, काम करने, cucumber.yml उदाहरण फ़ाइल यहाँ का एक अच्छा उदाहरण पाया: http://jdfrens.blogspot.com/2010/03/uh-yes-i-did-define-that-cucumber-step.html

संबंधित मुद्दे