23
© 2013 iZenBridge | CONFIDENTIAL Introduction to Automated Agile Testing Naveen Kumar Singh

Automated agile testing using Cucumber

Embed Size (px)

DESCRIPTION

Automated Agile Testing using Cucumber, Selenium and junit. Learn how to use BDD

Citation preview

Page 1: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Introduction to

Automated Agile Testing

Naveen Kumar Singh

Page 2: Automated agile testing using Cucumber

© 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

Page 3: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Agile Testing

Page 4: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Expectation

ROI

Reusability

Early Defect Detection

Efficiency in test design + execution

Cost of Defect

Cycle time

Defect leakage

Downtime

Page 5: Automated agile testing using Cucumber

© 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

Page 6: Automated agile testing using Cucumber

© 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

Page 7: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Test First Development

TDD, BDD and ATDD

Page 8: Automated agile testing using Cucumber

© 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

Page 9: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Test Driven Development

Test driven development (TDD)

• Think• Red• Green• Clean (Refractor)

Test

Code

Refactor

Page 10: Automated agile testing using Cucumber

© 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.

Page 11: Automated agile testing using Cucumber

© 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

Page 12: Automated agile testing using Cucumber

© 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

Page 13: Automated agile testing using Cucumber

© 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

Page 14: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

BDD is a Agile process

BDD encourages collaboration between developers, QA and non-technical or business participants in a software project.

Page 15: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Behavior Driven Development (BDD)

BDD

Given- Set of preconditions

Then-Some testable outcome

When-When a event occurs

Page 16: Automated agile testing using Cucumber

© 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

Page 17: Automated agile testing using Cucumber

© 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

Page 18: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Tools

ATDD

FitNesse

Spectacular

Concordian

Thucydides

BDD

SpecFlow

Cumumber

JBehave

NBehave

Behat

TDD

JUnit

NUnit

TestNG

MSTest

Page 19: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

BDD in Action

Example using Java and Cucumber

Write feature file

Generate step file

Execute test

Page 20: Automated agile testing using Cucumber

© 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

Page 21: Automated agile testing using Cucumber

© 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

Page 22: Automated agile testing using Cucumber

© 2013 iZenBridge | CONFIDENTIAL

Page 23: Automated agile testing using Cucumber

© 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