Automated testing is important for Rails applications because it saves time by reducing manual testing and catches regression errors. The document discusses different testing approaches like test-driven development (TDD), behavior driven development (BDD), and specific tools used for testing Rails apps like MiniTest, RSpec, Cucumber, and Capybara. TDD focuses on writing tests before code, BDD uses a domain-specific language to describe tests in a way that both developers and customers understand, and these tools can automate different types of tests for Rails.
2. Testing Saves Your...
Why?
We're Human...
Think about Your Code
Regression Tests
Manual Testing... bleh
Save Time
Happy Customers!
Test Driven Development
(TDD)
Behavior Driven Development
(BDD)
3. TDD
Built into Rails
Specific Details of Failure
Assert - Evaluates the argument passed is True
Note: In Rails 4, Test::Unit has been superseded by MiniTest. MiniTest is
included in the Ruby Standard library.
Example
Test::Unit
4. BDD
Gem
Language is Easy to Understand
o Domain Specific Language (DSL)
o Developers and Customers Understand the Tests
spec directory
Describes the behavior of the fixture (Bacon).
Example
RSpec
5. BDD
Gem
http://cukes.info/
DSL
Reads like Acceptance Criteria
Example
Cucumber
6. BDD
Gem
Web Simulator
Support Selenium WebDriver
Example
Capybara