Pro Yearly is on sale from $80 to $50! »

Cucumber on Scala

Cucumber on Scala

Quick introduction to Scala for Ruby developers. I showcased Cucumber running in a Play (Scala) application.

Presentation I gave for the Ruby user group in Vienna.

7f950a34b032ab9d6eaa4530a37943be?s=128

Sebastian Nozzi

September 05, 2013
Tweet

Transcript

  1. on Sebastian Nozzi viernes 6 de septiembre

  2. Background • Working with Java since 2001 • Flirting with

    Smalltalk all these years • Developing with Rails since September 2012 • Hooked with Scala since January 2013 • Developing with Play since June 2013 viernes 6 de septiembre
  3. Scala Quick introduction to ... for developers viernes 6 de

    septiembre
  4. Lightweight Syntax Object-Oriented Strong Static Typing Functional Scala Ruby Haskell

    viernes 6 de septiembre
  5. Some Code viernes 6 de septiembre

  6. class Greeter(var name: String = "World") { def sayHi {

    println(s"Hello $name!") } def sayBye { println(s"Bye $name, come back soon.") } } val g = new Greeter greeter.sayHi >> "Hello World!" greeter.name = "vienna.rb" greeter.sayHi >> "Hello vienna.rb!" greeter.name >> "vienna.rb" viernes 6 de septiembre
  7. ScalaTour.com powered by scalaKata.com viernes 6 de septiembre

  8. viernes 6 de septiembre

  9. Similarities: Ruby / Scala • Object Oriented • Mixins /

    Traits • Blocks / First-class Functions • Powerful Collection APIs • method_missing / Dynamic trait • Console / REPL • More Elegant than predecessor (Perl / Java) viernes 6 de septiembre
  10. Cultural Impact of Ruby / Rails • Developer happiness matters

    • Productivity matters • Elegance matters • Lambdas are a must • DSLs are cool viernes 6 de septiembre
  11. viernes 6 de septiembre

  12. • Borrows heavily from Rails • Convention over Configuration •

    Routes • REST / MVC • Models, Controllers, Fragments, Helpers, etc. • Save + Reload viernes 6 de septiembre
  13. 3 Aspects I missed from Rails (from many many more

    ;-) viernes 6 de septiembre
  14. ActiveRecord db:migrate Cucumber ActiveRecord (for Scala) Flyway Cucumber-JVM today viernes

    6 de septiembre
  15. viernes 6 de septiembre

  16. Feature: Posting status updates The goal of the system is

    keep co-workers informed by posting status updates. Background: Given that user "manager" exists And that user "manager" posted | first day at work | | meeting people | | working like crazy | Scenario: Posts are ordered chronologically (newest on top) When I go to the posts page of user "manager" Then the post nr. 1 should contain "working" And the post nr. 2 should contain "meeting" And the post nr. 3 should contain "first" Feature name Description These steps get executed before each Scenario Steps in a Scenario Scenario name viernes 6 de septiembre
  17. And("""^press "([^"]*)"$""") { (buttonLabel: String) => ... ... } triple-quotes

    triple-quotes allows using unescaped quotes viernes 6 de septiembre
  18. And("""^press "([^"]*)"$""") { (buttonLabel: String) => ... ... } block

    viernes 6 de septiembre
  19. And("""^press "([^"]*)"$""") { (buttonLabel: String) => ... ... } capturing

    group corresponding parameter viernes 6 de septiembre
  20. Then("""^the user should have (\d+) posts$""") { (amountPosts: Int) =>

    ... ... ... } capturing group corresponding parameter notice the type viernes 6 de septiembre
  21. Cucumber Demo viernes 6 de septiembre

  22. viernes 6 de septiembre

  23. Conclusion • Ruby / Rails influcence is everywhere • Possible

    for me to have some the Ruby coolness • Other languages (ahem, Scala) have cool ideas/concepts too ;-) • Ruby / Rails source of innovation and inspiration Keep innovating and making the world cool! viernes 6 de septiembre