Ruby - a tester's best friend

2,342 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,342
On SlideShare
0
From Embeds
0
Number of Embeds
884
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ruby - a tester's best friend

  1. 1. Ruby - a tester’s best friendPeter Lind @peter_lind
  2. 2. Ruby, wait what? Born in 1993 Object-oriented Dynamic Open Source Elegant syntax Focus on programmer happiness Great for scripting And for apps Ruby On Rails?
  3. 3. Basics [array] {hash_key: hash_value} {hash_key => hash_value} do |var| <block body> end { |var| <block body> } class ClassName <class body> end def method_name <method body> end local_variable, @instance_variable, @@class_variable, Constant, $global
  4. 4. Basics ruby script.rb IRB gems – gem install <library> rake – Rakefile
  5. 5. How to install Use version 1.9.2 OSX / Linux – Might already have it – If not, use RVM • http://beginrescueend.com/rvm/install/ Windows – Use Railsinstaller • http://railsinstaller.org/
  6. 6. Culture Ruby is your friend, not your parent
  7. 7. Culture Ruby is your friend, not your parent Everything can be redefined
  8. 8. Culture Ruby is your friend, not your parent Everything can be redefined Readability
  9. 9. Culture Ruby is your friend, not your parent Everything can be redefined Readability
  10. 10. Culture Ruby is your friend, not your parent Everything can be redefined Readability TDD/BDD
  11. 11. Tools Sinatra – Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort – http://www.sinatrarb.com/
  12. 12. Tools Sinatra – Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort – http://www.sinatrarb.com/ Cucumber – BDD that talks to domain experts first and code second – http://cukes.info/
  13. 13. CucumberFeatures– Describes scenarios– In the Gherkin language, almost English (or over 40 other)– Given, When, Then
  14. 14. CucumberFeatures– Describes scenarios– In the Gherkin language, almost English (or over 40 other)– Given, When, ThenStep definitions– In Ruby– Available for Java, .NET others
  15. 15. Tools Sinatra – Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort – http://www.sinatrarb.com/ Cucumber – BDD that talks to domain experts first and code second – http://cukes.info/ Capybara – Acceptance test framework for web applications – https://github.com/jnicklas/capybara
  16. 16. Cucumber and Capybara example http://www.youtube.com/watch?v=S5XQTOVTPYY https://github.com/peterlind/cuke4all
  17. 17. Java Web AppTests
  18. 18. pets.feature PickleFeature: Manage pets Scenario: List pets Given a pet exists with name: "Fido", sort: 0, weight: 23 When I go to the list pets page Then I should see "Fido" Scenario: Enter a pet Capybara Given I am on the enter pet page And I fill in "Name" with "Rufus" And I fill in "Sort" with "Cat" And I fill in "Weight" with "8" And I press "Save" Then a pet should exist with name: "Rufus", weight: 8
  19. 19. THANKS!peter.lind@valtech.se@peter_lind

×