bdd

Capybara and before(:all) in rspec

独自空忆成欢 提交于 2019-12-23 15:29:08
问题 Here's my complete spec: require 'spec_helper' describe "Idea page", js: true do subject { page } before(:all) do create(:idea) visit root_path click_link "Log In" end context "Single idea" do before do page.find(:xpath, '//*[@id="accordion"]/div/div[1]/a').click end it { should have_selector('a',text:'Claim') } it "should have a button for reporting the idea" it "should have a button for opening all links" describe "Claiming" do before do click_link "Claim" end it {should have_selector('a',

Add custom info to JBehave HTML report

那年仲夏 提交于 2019-12-23 13:19:16
问题 When generating reports, JBehave automatically puts the story contents into the report, along with possible assertion failures. So far, so good. However, I would like to add some more information, especially (but not necessarily limited to) failing steps. In the concrete case at hand, the test generates random file names to guarantee uniqueness while running the scenario. I would like these names, that are generated in my @Given or @When annotated methods, to be included in the report. I find

Integrating external data source with Cucumber feature file

帅比萌擦擦* 提交于 2019-12-23 13:12:06
问题 I am new to Cucumber and the feature files it uses for BDD. I want to know if there is any way I could directly give the filepath of my external data file (eg. CSV file), and fetch the values of the parameters I use to create my test script. 回答1: You can add a tag with parameter to the features @data("/path/data.json") Scenario: Login as zinc admin Given I open zinc homepage And then create hook that reads the param and loads file before running a scenario. Before do |scenario| // read data

Cucumber.js debugging in IntelliJ

早过忘川 提交于 2019-12-23 12:19:26
问题 IntelliJ has a plugin for Cucumber.js. This suppose to enable running and debugging inside the IDE. The run configuration for cucumber.js works, but the debug mode is deactivated (Debug button can not be clicked). Does anybody else has the same problem and managed to solve it? Debugging is very essential to me. Thanks! 回答1: Instead of using the cucumber.js plugin, I used the run/debug configuration of node.js. I just set the run config of the node.js plugin like that -> JavaScript file: node

Should Gherkin scenario always have When step?

老子叫甜甜 提交于 2019-12-23 09:49:17
问题 When defining scenarios in Gherkin sometimes there is no clear distinction between Given and When steps, i.e. there is no active interaction with the system from the user and the purpose of the validation is to verify how the system should look under certain circumstances. Consider the following: Scenario: Show current balance Given user is on account page Then user should see his balance vs Scenario: Show current balance When user goes to account page Then user should see his balance I am

Running capybara with nginx

和自甴很熟 提交于 2019-12-23 09:31:54
问题 Is is possible to run capybara with nginx and passenger? instead or webrick? Capybara is installed with cucumber in a rails app. 回答1: It is easy - the only thing you have to do is to switch your mind - neither capybara nor cucumber are not tied to local environment you can test application that is located in internet and it will not care about it - you can even test google.com if you want. For your particular problem you'll have to set Capybara.run_server = false Capybara.server_port = 8000 #

How to get Gherkin syntax highlighting for .feature files in Visual Studio?

青春壹個敷衍的年華 提交于 2019-12-23 08:29:15
问题 There's no highlighting for Feature, Scenario, Given, When, Then, etc. keywords by default. Is there a ready made template out there to enable this? 回答1: The recent vesions of SpecFlow have a built-in syntax highlighting for VS2010. 回答2: http://github.com/henritersteeg/cuke4vs does exactly this. 来源: https://stackoverflow.com/questions/2959173/how-to-get-gherkin-syntax-highlighting-for-feature-files-in-visual-studio

Testing JavaScript Click Event with Sinon

心不动则不痛 提交于 2019-12-23 07:46:44
问题 I am trying to produce some test to be able to better understand how to test DOM events with the combination of Mocha, Chai, Sinon and jQuery. I want to check that the alert function is correctly triggered on a click of the div element. I know that the setup of the HTML element is correct jQuery, but I'm not entirely sure how to produce a passing test for the code below. What's particularly strange is that I get a dialogue appearing on opening the HTML file in my browser, so I know the line '

Entity Framework 4 CTP 5 POCO - How to Unit Test my Repository<T>

◇◆丶佛笑我妖孽 提交于 2019-12-23 04:48:08
问题 This is the 2nd part of another question Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable), where I asked how to implement a generic repository pattern using EF 4 POCO. Now that my repository is working, I would like to know how to unit test my Repository (TDD or BDD). Thanks all. 回答1: Hey I wrote some blog posts on doing this with SpecFlow. But that was a disaster when it got complex. I tried to implement a testing repository which was also a disaster. Trying to

Entity Framework 4 CTP 5 POCO - How to Unit Test my Repository<T>

纵然是瞬间 提交于 2019-12-23 04:48:00
问题 This is the 2nd part of another question Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable), where I asked how to implement a generic repository pattern using EF 4 POCO. Now that my repository is working, I would like to know how to unit test my Repository (TDD or BDD). Thanks all. 回答1: Hey I wrote some blog posts on doing this with SpecFlow. But that was a disaster when it got complex. I tried to implement a testing repository which was also a disaster. Trying to