# Call ‘byebug’ anywhere in the code to stop execution and get a debugger consoleĬapybara is a gem to enable browser testing from the command line and database_cleaner keeps your test database nice and tidy between tests. # gem ‘capistrano-rails’, group: :development You should find that you already have these ‘groups’ in your gemfile, and that the ‘chromedriver-helper’ gem is already included too. This ‘group :test’ structure tells Bundler that these are only for testing so these Gems won’t be pushed to the production server. You can uncomment that and swap Webrat for Capybara. You’ll find a commented out section like this at the end of the file. Step 1) Open and change the Gemfile to include a section like the one below. You will also need to look at the CucumberWiki, the Capybaraexamples, and the Capybara ‘cheat sheet’ for DSL examples of how to manipulate web page elements.Īs we’re sorting out the test structure ourselves we need to modify the Gemfile to add RSpec and Cucumber before we bundlethe app together. If it feels like lots of tests, or steps keep failing, then remember this: By failing lots, we also prove that what we are doing is the correct step at that point because our work makes the tests pass. You should also read Rachel Davies’s post on BDD in a Nutshell, which explains about the roles people have in the BDD process. The Big PictureĬucumber, RSpec and Capybara are part of Behaviour DrivenDevelopment, and as such is something you should do with clients as discussed by Liz Keogh’s BDD Tutorial slides – which are great for explaining the reasons and background of BDD and on how to transition from TDD to BDD. This will walk you through a number of scenarios, but can really only scratch the surface of the subject. The practical shows you how to use Cucumber, RSpec andCapybara tests in Rails to ensure that your web application works correctly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |