drugpl / bbq

Object oriented acceptance testing using personas.
MIT License
92 stars 9 forks source link

Add Pretty documentation? #21

Closed ryanong closed 12 years ago

ryanong commented 12 years ago

Just saw this blog. I might try to add some syntax sugar similar to this.

http://blog.railsware.com/2012/01/08/capybara-with-givenwhenthen-steps-in-acceptance-testing/

If anybody else would be interested in this feature I would take a stab at it.

paneq commented 12 years ago

I do not think it is necessary in bbq.

# example from the link you submitted
# RSpec+Capybara+Steps way
Then "I should see greeting" do
  page.should have_content("Welcome, #{@user.email}!")
end
# my bbq way
module GreetingsAware
  def see_greeting!
    see!("Welcome, #{options[:email]}!")
  end
end

robert = TestUser.new(:email => "robert@example.com")
robert.extend(GreetingsAware)
robert.see_greeting!

So I think that instead of providing such descriptions about what you are doing we should just use use method names as an abstraction. The name of the method should be well thought and probably come from the domain of the project. Have a look at our README file.

IMHO Programmers do not need those descriptions such as Then "I should see greeting" do. It is unnecessary noise in the test. If you want to generate something readable by non-programmer (project owner, client ...) I think that you should go with Cucumber. If the tests are not intended to be specified by or with non-programmer stakeholder help then I see no value in having such descriptions. Nothing that could not be achieved by extracting things into properly named methods or just writing # comments.

paneq commented 12 years ago

However feel free to release such feature in your own gem. We will be happy to provide an info about it in our README.

ryanong commented 12 years ago

It seems useful for clients when they want to see some documentation on what the code you have done actually does. I think you are write a gem definitely might be better for this