Product development   with cucumber with just enough infrastructure          Michael Nacos
Introwhat to expect from this talk● integration tests=important for a tech startup● cucumber ecosystem is ideal for our st...
Introcucumber as part of a whole          and too many others...
leemailleemail for peoplebookmarklet
leemailwhy●   to let people share their email fearlessly●   to shift unsubscribe power back to people●   to encourage ethi...
leemailleemail for businesses● do you collect  email addresses?● are you good?● do you want to  shout it?we help you estab...
cukes over timewhat do the cukes look like                     cukes are part of the source tree
cukes over timestories, branches
cukes over time                               Cukes or                               else!Monday   Tuesday   Wednesday   T...
stack requirementsnetbooksif it can:  ● run cukes  ● connect to a vpn  ● git pull/push         ... its a dev machine      ...
stack requirementsemail is different (esp. for leemail)● mail servers need dns records, you cannot  send to test@127.0.0.1...
stack requirementsconfiguration is part of the product# setup postfix%w{dynamicmaps.cf mailbox_commands main.cf master.cf ...
stack requirementsrails environments      (taking advnatage of)               good for interactive tests on your local    ...
what we testvaluewe want to know:● existing functionality has not been broken● new functionality is correct● before deploy...
what we testRAILS_ENV=testif it speaks SMTP and it can follow some rulesand deliver messages to a RabbitMQ queue...  its a...
how we testextending our Worldin local_env.rb:   require ...   World(EmailHelpers)in email_helpers.rb:   module EmailHelpe...
how we testpostfix_stub              (filesystem mbox)                             emails           ruby mailrubynet/smtp ...
examplesleemail reply
examplesbandit
tipsi18nmakes your cukes less brittleyou can write:Then I should see flash message "devise.sessions.signed_in"
tipsjavascriptgem capybara-webkit # requires apt-get install libqt4-devin env.rb:   # use webkit driver in @javascript sce...
challengesiframes (well, leemail iframes)  find iframe        nav in iframe     js in iframe     nav in parent
Product development with cucumber     @mnacos                @leemailme      https://leemail.me/r/CUKEUP                Th...
Upcoming SlideShare
Loading in …5
×

CukeUp! 2012: Michael Nacos on Just enough infrastructure for product development with cucumber

881 views
781 views

Published on

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

No Downloads
Views
Total views
881
On SlideShare
0
From Embeds
0
Number of Embeds
150
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

CukeUp! 2012: Michael Nacos on Just enough infrastructure for product development with cucumber

  1. 1. Product development with cucumber with just enough infrastructure Michael Nacos
  2. 2. Introwhat to expect from this talk● integration tests=important for a tech startup● cucumber ecosystem is ideal for our stack and our product requirements● cucumber + git + chef = heart● duck test/typing referencesdont expect:● the definitive cucumber style guide● plug-and-play solutions
  3. 3. Introcucumber as part of a whole and too many others...
  4. 4. leemailleemail for peoplebookmarklet
  5. 5. leemailwhy● to let people share their email fearlessly● to shift unsubscribe power back to people● to encourage ethical behaviour from vendors● to help vendors safeguard their reputation and customer data its about connecting, in a way that makes everyone happy
  6. 6. leemailleemail for businesses● do you collect email addresses?● are you good?● do you want to shout it?we help you establishand secure therelationship againstleaks and bad PR
  7. 7. cukes over timewhat do the cukes look like cukes are part of the source tree
  8. 8. cukes over timestories, branches
  9. 9. cukes over time Cukes or else!Monday Tuesday Wednesday Thursday Friday
  10. 10. stack requirementsnetbooksif it can: ● run cukes ● connect to a vpn ● git pull/push ... its a dev machine OR editors: ● 2 vi users ● 1 emacs ● 1 notepad++
  11. 11. stack requirementsemail is different (esp. for leemail)● mail servers need dns records, you cannot send to test@127.0.0.1● there is an excellent mail gem, but no smtp server gem afaik● gems like mailtrap exist but our smtp servers do more than just accept emails● our daemons feed off rabbitmq queues, they shouldnt have to be changed for tests● ideally, wed have a lightweight smtp server which supports rules and delivers to rabbit
  12. 12. stack requirementsconfiguration is part of the product# setup postfix%w{dynamicmaps.cf mailbox_commands main.cf master.cf sender_canonicalpassword restricted_destinations sender_relayhosts}.each do |cfg| template "/etc/postfix/#{cfg}" do source "postfix/#{cfg}.erb" owner "root" group "root" mode cfg == password ? 0640 : 0644 notifies :restart, resources(:service => "postfix") endend Serversgit pull Dev env# ok, you need to satisfy an erlang dependency manually once
  13. 13. stack requirementsrails environments (taking advnatage of) good for interactive tests on your local machine, no email infrastructure, run mailtrapdevelopmenttest for automated tests, minimum viable test environment for email testing availableproduction for interactive tests on a server, chef dependency and configuration management a given
  14. 14. what we testvaluewe want to know:● existing functionality has not been broken● new functionality is correct● before deploying to a serverwithout:● expensive equipment● maintaining dev-specific environments● building internet replicas locally
  15. 15. what we testRAILS_ENV=testif it speaks SMTP and it can follow some rulesand deliver messages to a RabbitMQ queue... its a leemail mailservthen the cukes can focus on things like:● are email headers re-written properly?● do daemons deliver only to on connections?etc.
  16. 16. how we testextending our Worldin local_env.rb: require ... World(EmailHelpers)in email_helpers.rb: module EmailHelpers # called before each scenario def self.extended(base) end end # setting up email environment at cucumber startup EmailHelpers.setup_test_email_environment # tearing down email environment at cucumber exit at_exit do EmailHelpers.tear_down_test_email_environment end
  17. 17. how we testpostfix_stub (filesystem mbox) emails ruby mailrubynet/smtp SMTP leemails ruby amqp (RabbitMQ)in email_helpers.rb:def get_messages_from_mbox(mbox_path) # parsing mbox format raw_messages = IO.read(mbox_path).split(/nFrom .+n/) # returning a list of mail messages raw_messages.map { |r| Mail.read_from_string(r) }end
  18. 18. examplesleemail reply
  19. 19. examplesbandit
  20. 20. tipsi18nmakes your cukes less brittleyou can write:Then I should see flash message "devise.sessions.signed_in"
  21. 21. tipsjavascriptgem capybara-webkit # requires apt-get install libqt4-devin env.rb: # use webkit driver in @javascript scenaria Capybara.javascript_driver = :webkit # setting the test server port to a known value Capybara.server_port =AppConfig[test_server_port]then add @javascript tag to specific cukes
  22. 22. challengesiframes (well, leemail iframes) find iframe nav in iframe js in iframe nav in parent
  23. 23. Product development with cucumber @mnacos @leemailme https://leemail.me/r/CUKEUP Thank You

×