This framework originally has no support for integration testing but in the next release they will integrate rbehave which is a nice framework for writing "user story"-like tests. (User story beeing the agile version of use cases, which are formulated as a short story). Here comes an example of rbehave from another blog
Story "View Home Page", %{
As a user
I want to view my home page
So that I can get a birds eye view of the system
}, :type => RailsStory do
Scenario "Publisher with no videos" do
Given "a company named", "No Videos" do |name|
@company = Company.create! :name => name
end
And "a user named", "novideos" do |login|
@user = create_user login
end
And "the user belongs to", "company", "No Videos" do |klass, company_name|
@user.update_attribute :company, klass.classify.constantize.find_by_name(company_name)
end
And "logged in as", "novideos" do |login|
post "/sessions", :login => login, :password => "test"
end
When "visiting", "/" do |page|
get_via_redirect page
end
Then "viewer should see", "companies/show_initial" do |template|
response.should render_template(template)
end
end
The rbehave framework, which essentially is a port of the user-story based java testing framework Jbehave, is very fresh and most likely still has some problems. It seems for example, by reading a couple of blog posts (such as this) , that there could be a bit of a problem to get the framework to work with Continues Integration (CI) which soundcloud uses.
Otherwise this seems like an ideal framework to use, and as soon as the next release of Rspec we will start using it I think. (Maybe even sooner )
Inga kommentarer:
Skicka en kommentar