Upload
naveen-kumar-singh
View
164
Download
3
Embed Size (px)
DESCRIPTION
Automated Agile Testing using Cucumber, Selenium and junit. Learn how to use BDD
Citation preview
© 2013 iZenBridge | CONFIDENTIAL
Introduction to
Automated Agile Testing
Naveen Kumar Singh
© 2013 iZenBridge | CONFIDENTIAL
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
• Reach out to me
• LinkedIn - in.linkedin.com/in/naveenkumarsingh1/• Twitter - https://twitter.com/naveenhome• Mail – [email protected]• Blog - scrumcertifications.blogspot.in
© 2013 iZenBridge | CONFIDENTIAL
Agile Testing
© 2013 iZenBridge | CONFIDENTIAL
Expectation
ROI
Reusability
Early Defect Detection
Efficiency in test design + execution
Cost of Defect
Cycle time
Defect leakage
Downtime
© 2013 iZenBridge | CONFIDENTIAL
Testing Strategy and Roles
Tester Developer
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
© 2013 iZenBridge | CONFIDENTIAL
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
acceptance tests
• N = current sprint
© 2013 iZenBridge | CONFIDENTIAL
Test First Development
TDD, BDD and ATDD
© 2013 iZenBridge | CONFIDENTIAL
TDD Cycl
e
Red
GreenClean
Distill
Demo
Item
Discuss
Develop
Story
ATDD Cycle-Acceptance Test Driven Development (ATDD) Cycle
Test First Development
© 2013 iZenBridge | CONFIDENTIAL
Test Driven Development
Test driven development (TDD)
• Think• Red• Green• Clean (Refractor)
Test
Code
Refactor
© 2013 iZenBridge | CONFIDENTIAL
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
Close collaborationSeeing concrete, working softwareBuilding trust and confidenceCustomer in controlEvolving a shared language
Tests as a shared languageTests as specificationSpecification by example
© 2013 iZenBridge | CONFIDENTIAL
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)
BDD
Given- Set of preconditions
Then-Some testable outcome
When-When a event occurs
© 2013 iZenBridge | CONFIDENTIAL
BDD
Story: Returns go to stock
In order to keep track of stockAs a store ownerI 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 meAnd I currently have three black sweaters left in stockWhen he returns the sweater for a refundThen 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 garmentAnd I have two blue garments in stockAnd three black garments in stock.When he returns the garment for a replacement in black,Then I should have three blue garments in stockAnd 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
© 2013 iZenBridge | CONFIDENTIAL
BDD in Action
Example using Java and Cucumber
Write feature file
Generate step file
Execute test
© 2013 iZenBridge | CONFIDENTIAL
BDD in Action
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
© 2013 iZenBridge | CONFIDENTIAL
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 SinghE : [email protected] : +91 98105 47500T : @naveenhomeS :http://www.scrumalliance.org/community/profile/nkumarsingL : https://www.linkedin.com/in/naveenkumarsingh1