bdd

Is there a way to make freshen tests fail on undefined tests?

By default when I run a freshen scenario, which contains an undefined given/when/then clause, that test is simply marked as undefined. No further helpful message as to what actually isn't defined is given. Is there a way to change this behavior to get more information what exactly was undefined? ...

How can I test common Rails controller behavior while staying DRY?

I've been writing RSpec tests for some Rails controllers and I've discovered a strong impulse to ensure that the Authlogic authentication is working properly. I also feel like I should be verifying that each action uses the same application-wide layout. However, writing tests for this behavior in every single action seems silly. What I'...

Mixing Then and When in BDD User Stories/Acceptance Tests

How do you handle user stories/acceptance tests that have long chains like this one, where the Then/When mingle together? Is it best to split this into a separate acceptance test where one tests that the dialog appears and then the second one tests the behavior after the dialog has been shown? Feature: Confirmation before removing prod...

What is the difference between an easyb story and specification?

I've been trying out the easyb BDD framework for about a day and a half and I'm not sure I understand the difference between a story and a specification(besides the syntax). A story uses the given, when, then syntax and a scenario uses the description, it, it... syntax. Besides the syntax is there a difference between the two? Is u...

Where do you place documents belonging to a Rails app project?

For every project it's like having two parts: the Rails application and then all documents and pictures related to it. I wonder how you organize them both. Do you put everything under the same project root folder and apply Git on that folder or don't you protect your documents with Git at all? Then, what if the docs are too sensitive ...

Rails + cucumber + webrat + selnium : Periodic error on first scenario in feature

I have setup cucumber+webrat+selenium to test my rails app. This works well locally, and works about 50% of the time on my build (CI) server. The other 50% of the time, the first scenario in each feature fails with this error: Failed to start new browser session, shutdown browser and clear all session data Back trace starts with: or...

Application Testing with Rails

Hi, This is more of a general question and some sort of best practice discussion. How would one test a Rails application? There are mantras like BDD and TDD and frameworks like RSpec and Cucumber but how much is enough and what is the best way to go? Is it enough to use Cucumber as integration tests? Are you guys writing additional ...

Writing view_spec for login form with authlogic (rspec2)

Hi there, i am trying to write a view_spec for my login form that uses authlogic. This is my current view_spec: require 'spec_helper' describe "user_sessions/new.html.haml" do before :each do user_session = mock("UserSession").as_null_object assign(:user_session, user_session) end it "should have a login form" do re...

How can I make cucumber with capybara and selenium fire Ajax on page load

I have the following as a cucumber story: @javascript Scenario: Showing the page Given I am a logged in user And there is a member with a site And I go to the home page ..... When that home page is loaded, there is a drop down that is populated via AJAX on page, in the selenium run browser test the $(document).ready(funtion...

Routing problem with cucumber

hello coders and codetts I am working with rails 3 and cucumber, all is going well except for this little problem Given I am on the "edit automobile" page No route matches {:controller=>"automobiles", :action=>"edit"} (ActionController::RoutingError) Now the path is set in paths.rb as edit_automobile_path and in the routes.rb I ha...

Getting started with BDD and nStep

In a previous question found here, I asked a question about BDD and SpecFlow. The best answer was to use nSpec instead of SpecFlow. I found nSpec, but I am having trouble finding tutorials on how to use it with C#. My google mojo isn't working for this topic. Apart from the small instructional on the nSpec github site on how to insta...

Valid BDD Scenario Steps? Given -> When -> Then -> When

If I have the following steps defined, is this valid scenario? I feel like it is some kind of smell. Scenario: Change users status Given I have the following users exist: | code | status | | u1 | active | | u2 | inactive | | u3 | active | And the status filter is "active" When I up...

When I write a feature that uses the same verbiage as other features, how do I make sure the right steps are called for persistence?

I am writing features with the same verbiage for some scenarios. Feature: User Management Scenario: Edit an existing user's details Given a user exists and Feature: Group Management Scenario: Add a user to a group's membership Given a user exists And a group exists In SpecFlow is there a good way to define what step each feature ca...

should i only be testing public interfaces in BDD (in general, and specifically in ruby)

I'm reading through the (still beta) rspec book by the prag progs as I'm interested in behavioral testing on objects. From what I've gleaned so far (caveat: after only reading for 30 min) the basic idea is that I want ensure my object behaves as expected 'externally' ie. in its output and in relation to other objects. Is it true then t...

Rails 3 with Rspec2 and authlogic: Cannot spec requests & views

I'm having trouble creating specs for my views and requests. Some of my controllers use named_scope, like this: #projects_controller.rb @projects = Project.with_user( current_user) ## project.rb: scope :with_user, lambda {|u| {:joins => :client, :conditions => {:clients => {:user_id => u.id} } }} but the following spec gives an ...

Factory_girl or machinist?

Are you using factory_girl or machinist for stubbing/mocking in Rails tests? ...

Cucumber & webrat, selecting from a radio button list

I'm trying to get webrat to select a radio button from a list, using cucumber. I have this scenario: Scenario: Update an existing article Given I have an article with title Big Bananas and body text Big yellow bananas are good for you And I am on the list of articles When I choose "Big Bananas" And press "Update article...

Speeding up RSpec tests in a large Rails application

I have a Rails application with over 2,000 examples in my RSpec tests. Needless to say, it's a large application and there's a lot to be tested. Running these tests at this point is very inefficient and because it takes so long, we're almost at the point of being discouraged from writing them before pushing a new build. I added --profile...

Initialize cucumber folder structure?

Is there an easy way to initialize a cucumber folder structure like rails generators? ...

is it practically possible to do good TDD (or BDD) without using any DI framework in java?

IMO one of the main characteristics of a good TDD is: testing your class (or actually unit) in isolation. When you do so, you are able to actually test single behavior in each test -- only one test will fall for a single problem you have. For this you first must verify that there are no static references from your class (including cons...