Testing is fun
     A developer's perspective
blogger:    http://gouravtiwari.blogspot.com


 github:    http://github.com/gouravtiwari21


  email:    gouravtiwari21@gmail.com
            g.tiwari@tcs.com


 twitter:   @gouravtiwari21
1. Why something is fun?

2. Unit, functional and Acceptance
   testing – fun with Ruby on Rails

3. Quality Tests
Testers Vs. Developers: Code War
Testers + Developers = Quality Product
Fun is like beauty - it's in the eyes of the beholder
Why something is fun?
1. Why something is fun?




   Problem solving

   Pattern recognition

   Creativity and lateral thinking
1. Why something is fun?



                    My Nephews and Nieces
1. Why something is fun?




Why a kid hate something?
   Feeling of burden and boredom
   Patience test

   Tough to do
1. Why something is fun?




Why a kid like something?
   Curiosity and involvement
   Sense of accomplishment

   Easy to do and easy to iterate
1. Why something is fun?



                           My Perspective
1. Why something is fun?




No, testing is not fun,
WHEN
    This works on my development box!

    Workbench-mess

    Slow Tests
1. Why something is fun?




Yes, I want to do it
WHEN
    Use right tools and right test data

    Clean Workbench

    Run tests – every 30 secs!
Unit, functional and Acceptance testing –
                  fun with Ruby on Rails
2. Unit, functional and Acceptance testing - fun with Ruby on Rails



         (Development + Testing) Approach ?




Bottom-up (Inside-out)                                             Top-down (Outside-in)
2. Unit, functional and Acceptance testing - fun with Ruby on Rails




Cucumber & RSpec
  Outside-in approach

  Only write what is meaningful

  Close interaction of PO and developer
2. Unit, functional and Acceptance testing - fun with Ruby on Rails




                                            BDD


        ATDD                                                            TDD


        BA/PO                                                         Developer
2. Unit, functional and Acceptance testing - fun with Ruby on Rails



                               Cucumber example
2. Unit, functional and Acceptance testing - fun with Ruby on Rails



                                          Outside-in


    Scenario                                   View                     Controller
          Step 1                                 Step 3                       Step 4




        Steps                                                              Model
          Step 2                                                              Step 5


Given                                                                 Pre-requisite
…                                                                     (masked data, mock, Stub)
                                                                      …
When
…                                                                     Action
                                                                      (invoke method)
Then
                                                                      …
…
                                                                      Validate output
                                                                      …
2. Unit, functional and Acceptance testing - fun with Ruby on Rails



                                  Tests with guard
Courtesy: https://github.com/visionmedia/git-extras
Patience test with cucumber
   100 tests & 1 sprint … a trivial example
Quality tests
Team testing time
  With friends and family
3. Quality tests




                   Metric Fu
3. Quality tests



                   Reek
3. Quality tests



                   Rcov
3. Quality tests



                   Flog
Easy to understand and easy to
follow steps are fun


With checks on code and code
quality, developer can have
sound sleep

ATDD, TDD and
BDD, DDD, anyother DD :
just concepts

development and testing
together is fun!
https://joind.in/6023
https://github.com/cucumber/cucumber/wiki/
http://www.thewebsqueeze.com/web-design-articles/the-
mac-ruby-developers-toolkit-25-essential-apps.html
http://rspec.info/
http://guides.rubyonrails.org/testing.html
http://metric-fu.rubyforge.org/
http://www.julianhermida.com/algoma/scotlteachingreso
urcesfeedback.htm

Testing is Fun @Confoo.ca 2012