Introduction to Automated Agile Testing © 2013 iZenBridge | CONFIDENTIAL Naveen Kumar Singh
Agile Testing • Software Developer, Agile coach and Trainer • Certified Scrum Professional (CSP), CSM, PMI-ACP, PMP • More than 17 Years of experience in Software development © 2013 iZenBridge | CONFIDENTIAL • Reach out to me • LinkedIn - in.linkedin.com/in/naveenkumarsingh1/ • Twitter - https://twitter.com/naveenhome • Mail – naveenhome@gmail.com • Blog - scrumcertifications.blogspot.in
Agile Testing © 2013 iZenBridge | CONFIDENTIAL
© 2013 iZenBridge | CONFIDENTIAL Expectation ROI Reusability Early Defect Detection Efficiency in test design + execution Cost of Defect Cycle time Defect leakage Downtime
Testing Strategy and Roles Tester Developer © 2013 iZenBridge | CONFIDENTIAL New Test Case Exploratory Test Control Defects New Code Fix Defects Write Unit Test Setup CI Review Unit Test Setup Test Tool Test Report Review System Test Cases Write Test Scripts & execute test automations Agile team consideration: Pairing Pair Programming (XP) – Developer/ Tester, Tester/Tester, Tester/Business Analyst
At any point of time, QA • Test the current stories • Pair with Dev to automate n-1 stories • Pair with BA to analyze n+1 stories and write © 2013 iZenBridge | CONFIDENTIAL acceptance tests • N = current sprint
Test First Development TDD, BDD and ATDD © 2013 iZenBridge | CONFIDENTIAL
Test First Development Red TDD Cycle Clean Green Distill Demo © 2013 iZenBridge | CONFIDENTIAL Item Discuss Develop Story ATDD Cycle-Acceptance Test Driven Development (ATDD) Cycle
Test Driven Development Test driven development (TDD) •Think •Red •Green •Clean (Refractor) © 2013 iZenBridge | CONFIDENTIAL Test Code Refactor
Acceptance Test Driven Development Acceptance Test-Driven Development (ATDD) is a development methodology based on communication between the business customers, the developers, and the testers. ATDD encompasses many of the same practices as Specification by Example, Behavior Driven Development (BDD), Example-Driven Development (EDD), and Story Test-Driven Development (SDD). All these processes aid developers and testers in understanding the customer’s needs prior to implementation and allow customers to be able to converse in their own domain language. © 2013 iZenBridge | CONFIDENTIAL
Acceptance Criteria What to check at the end of development? Ordered Pizza online then Pizza get delivered at home or confirmation mail in your inbox © 2013 iZenBridge | CONFIDENTIAL
Advantage of ATDD © 2013 iZenBridge | CONFIDENTIAL Close collaboration Seeing concrete, working software Building trust and confidence Customer in control Evolving a shared language Tests as a shared language Tests as specification Specification by example
Behavior Driven Development (BDD) BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters. – Dan North © 2013 iZenBridge | CONFIDENTIAL
BDD is a Agile process BDD encourages collaboration between developers, QA and non-technical or business participants in a software project. © 2013 iZenBridge | CONFIDENTIAL
Behavior Driven Development (BDD) Given- Set of preconditions BDD Then-Some testable outcome When-When a event occurs © 2013 iZenBridge | CONFIDENTIAL
© 2013 iZenBridge | CONFIDENTIAL BDD Story: Returns go to stock In order to keep track of stock As a store owner I want to add items back to stock when they're returned Scenario 1: Refunded items should be returned to stock Given a customer previously bought a black sweater from me And I currently have three black sweaters left in stock When he returns the sweater for a refund Then I should have four black sweaters in stock
© 2013 iZenBridge | CONFIDENTIAL BDD Scenario 2: Replaced items should be returned to stock Given that a customer buys a blue garment And I have two blue garments in stock And three black garments in stock. When he returns the garment for a replacement in black, Then I should have three blue garments in stock And two black garments in stock
© 2013 iZenBridge | CONFIDENTIAL Tools ATDD FitNesse Spectacular Concordian Thucydides BDD SpecFlow Cumumber JBehave NBehave Behat TDD JUnit NUnit TestNG MSTest
BDD in Action Example using Java and Cucumber © 2013 iZenBridge | CONFIDENTIAL Write feature file Generate step file Execute test
BDD in Action © 2013 iZenBridge | CONFIDENTIAL Story As a account I want to add two numbers so that I get sum of the two numbers immediately without having to do manually. Acceptance Criteria 1. It should only allow the integer numbers in the two fields 2. The two numbers should be less than 1000 3. The two numbers should not be less than 0 4. The sum of the two numbers should be shown in the ‘Result’ field
Best Practices • Use BDD to collaborate • You may use it for Acceptance Test • Use TDD for coding • Refactor regularly • Refactor to Design Patterns • Focus on continuous Delivery © 2013 iZenBridge | CONFIDENTIAL
© 2013 iZenBridge | CONFIDENTIAL
Stay Connected Naveen Kumar Singh E : naveen@izenbridge.com M : +91 98105 47500 T : @naveenhome S :http://www.scrumalliance.org/community/profile/nkumarsing L : https://www.linkedin.com/in/naveenkumarsingh1 © 2013 iZenBridge | CONFIDENTIAL

Automated agile testing using Cucumber

  • 1.
    Introduction to AutomatedAgile Testing © 2013 iZenBridge | CONFIDENTIAL Naveen Kumar Singh
  • 2.
    Agile Testing •Software Developer, Agile coach and Trainer • Certified Scrum Professional (CSP), CSM, PMI-ACP, PMP • More than 17 Years of experience in Software development © 2013 iZenBridge | CONFIDENTIAL • Reach out to me • LinkedIn - in.linkedin.com/in/naveenkumarsingh1/ • Twitter - https://twitter.com/naveenhome • Mail – naveenhome@gmail.com • Blog - scrumcertifications.blogspot.in
  • 3.
    Agile Testing ©2013 iZenBridge | CONFIDENTIAL
  • 4.
    © 2013 iZenBridge| CONFIDENTIAL Expectation ROI Reusability Early Defect Detection Efficiency in test design + execution Cost of Defect Cycle time Defect leakage Downtime
  • 5.
    Testing Strategy andRoles Tester Developer © 2013 iZenBridge | CONFIDENTIAL New Test Case Exploratory Test Control Defects New Code Fix Defects Write Unit Test Setup CI Review Unit Test Setup Test Tool Test Report Review System Test Cases Write Test Scripts & execute test automations Agile team consideration: Pairing Pair Programming (XP) – Developer/ Tester, Tester/Tester, Tester/Business Analyst
  • 6.
    At any pointof time, QA • Test the current stories • Pair with Dev to automate n-1 stories • Pair with BA to analyze n+1 stories and write © 2013 iZenBridge | CONFIDENTIAL acceptance tests • N = current sprint
  • 7.
    Test First Development TDD, BDD and ATDD © 2013 iZenBridge | CONFIDENTIAL
  • 8.
    Test First Development Red TDD Cycle Clean Green Distill Demo © 2013 iZenBridge | CONFIDENTIAL Item Discuss Develop Story ATDD Cycle-Acceptance Test Driven Development (ATDD) Cycle
  • 9.
    Test Driven Development Test driven development (TDD) •Think •Red •Green •Clean (Refractor) © 2013 iZenBridge | CONFIDENTIAL Test Code Refactor
  • 10.
    Acceptance Test DrivenDevelopment Acceptance Test-Driven Development (ATDD) is a development methodology based on communication between the business customers, the developers, and the testers. ATDD encompasses many of the same practices as Specification by Example, Behavior Driven Development (BDD), Example-Driven Development (EDD), and Story Test-Driven Development (SDD). All these processes aid developers and testers in understanding the customer’s needs prior to implementation and allow customers to be able to converse in their own domain language. © 2013 iZenBridge | CONFIDENTIAL
  • 11.
    Acceptance Criteria Whatto check at the end of development? Ordered Pizza online then Pizza get delivered at home or confirmation mail in your inbox © 2013 iZenBridge | CONFIDENTIAL
  • 12.
    Advantage of ATDD © 2013 iZenBridge | CONFIDENTIAL Close collaboration Seeing concrete, working software Building trust and confidence Customer in control Evolving a shared language Tests as a shared language Tests as specification Specification by example
  • 13.
    Behavior Driven Development(BDD) BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters. – Dan North © 2013 iZenBridge | CONFIDENTIAL
  • 14.
    BDD is aAgile process BDD encourages collaboration between developers, QA and non-technical or business participants in a software project. © 2013 iZenBridge | CONFIDENTIAL
  • 15.
    Behavior Driven Development(BDD) Given- Set of preconditions BDD Then-Some testable outcome When-When a event occurs © 2013 iZenBridge | CONFIDENTIAL
  • 16.
    © 2013 iZenBridge| CONFIDENTIAL BDD Story: Returns go to stock In order to keep track of stock As a store owner I want to add items back to stock when they're returned Scenario 1: Refunded items should be returned to stock Given a customer previously bought a black sweater from me And I currently have three black sweaters left in stock When he returns the sweater for a refund Then I should have four black sweaters in stock
  • 17.
    © 2013 iZenBridge| CONFIDENTIAL BDD Scenario 2: Replaced items should be returned to stock Given that a customer buys a blue garment And I have two blue garments in stock And three black garments in stock. When he returns the garment for a replacement in black, Then I should have three blue garments in stock And two black garments in stock
  • 18.
    © 2013 iZenBridge| CONFIDENTIAL Tools ATDD FitNesse Spectacular Concordian Thucydides BDD SpecFlow Cumumber JBehave NBehave Behat TDD JUnit NUnit TestNG MSTest
  • 19.
    BDD in Action Example using Java and Cucumber © 2013 iZenBridge | CONFIDENTIAL Write feature file Generate step file Execute test
  • 20.
    BDD in Action © 2013 iZenBridge | CONFIDENTIAL Story As a account I want to add two numbers so that I get sum of the two numbers immediately without having to do manually. Acceptance Criteria 1. It should only allow the integer numbers in the two fields 2. The two numbers should be less than 1000 3. The two numbers should not be less than 0 4. The sum of the two numbers should be shown in the ‘Result’ field
  • 21.
    Best Practices •Use BDD to collaborate • You may use it for Acceptance Test • Use TDD for coding • Refactor regularly • Refactor to Design Patterns • Focus on continuous Delivery © 2013 iZenBridge | CONFIDENTIAL
  • 22.
    © 2013 iZenBridge| CONFIDENTIAL
  • 23.
    Stay Connected NaveenKumar Singh E : naveen@izenbridge.com M : +91 98105 47500 T : @naveenhome S :http://www.scrumalliance.org/community/profile/nkumarsing L : https://www.linkedin.com/in/naveenkumarsingh1 © 2013 iZenBridge | CONFIDENTIAL