1. Home
  2. Training Library
  3. Agile Testing Methods, Techniques and Tools [A3]

Agile Testing Methods, Techniques and Tools [A3]

Three types of development

Test-driven development, acceptance test-driven development, and behaviour-driven development are three complementary techniques in use among Agile teams to carry out testing across the various test levels. 

Each technique is an example of a fundamental principle of testing, the benefit of early testing and QA activities, since the tests are defined before the code is written. 

Agile testing methods and tools must keep up with the speed of the agile project. Providing rapid feedback cycles will help the team to achieve its goal and become more agile.  

Testing within an agile project is not the sole responsibility of the Agile Tester. The whole development team should participate and to enable this new way of thinking new testing techniques were introduced. 

Test-Driven Development (TDD) 

Test-Driven Development (TDD) is used to develop code guided by automated test cases.  

The process for Test-Driven Development is: 

  • Add a test that captures the programmer’s concept of the desired functioning of a small piece of code 
  • Run the test, which should fail since the code doesn’t exist 
  • Write the code and run the test in a tight loop until the test passes 
  • Refactor the code after the test is passed, re-running the test to ensure it continues to pass against the refactored code 
  • Repeat this process for the next small piece of code, running the previous tests as well as the added tests

A diagram in a diamond shape, with four stages in a cycle. First, build test case flows to execute component test, which in turn flows to build code; retest till passed, which then flows to refactor and regression test, which flows to build test case again.

Test-Driven Development gained its popularity through XP but is also used in other Agile methodologies and sometimes in sequential lifecycles. It helps developers focus on clearly defined expected results. 

The tests are automated and are used in continuous integration. 

TDD – Key points and benefits 

  • TDD is not a testing practice, but a programming approach.  
  • Tests are primarily unit level and are code-focused, and enables the developers to focus on clearly defined expected results 
  • The tests are automated and used in continuous integration. 
  • Develop minimum code, refractor frequently so code is lean, fast, and maintainable 
  • Debugging should be easier due to small increments 
  • The tester’s role tends to be in support of the developer by bringing knowledge, experience and focus to the testing tasks. 
  • Testers are also good at suggesting negative tests. Developers tend to demonstrate that their code works when testing, rather than trying to break it. 
  • A clear understanding of the requirements is required as any misunderstandings will be written in the tests and subsequently into the code.

Acceptance Test-Driven Development – ATDD 

Acceptance test-driven development defines acceptance criteria and tests during the creation of user stories. 

Acceptance test-driven development defines acceptance criteria and tests during the creation of user stories

Acceptance test-driven development is a collaborative approach that allows every stakeholder to understand how the software component must behave and what the developers, testers, and business representatives need to ensure this behaviour.

Collaborative

Acceptance test-driven development is a collaborative approach that allows every stakeholder to understand how the software component must behave and what the developers, testers, and business representatives need to ensure this behaviour. 

 

Regression testing

Acceptance test-driven development creates reusable tests for regression testing.  

Specific tools support creation and execution of such tests, often within the continuous integration process. These tools can connect to data and service layers of the application, which allows tests to be executed at the system or acceptance level.  

ATDD allows quick resolution of defects and validation of feature behaviour. It helps determine if the acceptance criteria are met for the feature.

 

Acceptance Test-Driven Development Example

‘Swap SIM’ user story: 

‘As a Pay Monthly customer, I can change from my old SIM card to a new one so that I can view my online account’ 

Acceptance criterion 2:  

‘Old SIM number entered must be that currently registered to the Customer account’ 

Tests:  

  1. Enter existing SIM correctly. 
  2. Enter random SIM number in ‘Old SIM’ field. 
  3. Enter new SIM number in ‘Old SIM’ field. 
  4. Register a SIM card to a new account and immediately attempt to swap SIM. 

…and so on. 

Number of tests needed depends on whether this is existing validation being re-used.

Behaviour Driven Development (BDD)

Behaviour-driven development allows a developer to focus on testing the code based on the expected behaviour of the software. Because the tests are based on the exhibited behaviour of the software, the tests are easier for other team members and stakeholders to understand. 

BDD is much more oriented to the customer expectations of the software because the driving force is the behaviour of the system. This makes it easier for stakeholders to assist with creating tests as developers focus on testing the code based on the expected behaviour of the software. 

Participants in a workshop will define business need as structured scenarios using clear spoken language. Like User Stories, detail will be added by discussion. The structure used is the ‘Given, When, Then’ template. This template leads not just to good, detailed acceptance criteria, but also to acceptance test conditions and cases as the expected result is quoted in ’Then’. Good preconditions and business rules mean both acceptance criteria and testing should be improved. 

Specific behaviour-driven development frameworks can be used to define acceptance criteria based on the given/when/then format: 

  • Given some initial context 
  • When an event occurs 
  • Then ensure some outcomes 

 

From these requirements, the behaviour-driven development framework generates code that can be used by developers to create test cases. Behaviour-driven development helps the developer collaborate with other stakeholders, including testers, to define accurate unit tests focused on business needs. 

Example BDD

Given some initial context 

  • Example: User Type, any preconditions 

When an event occurs 

  • Example: Submit a page, click a link, select an option 

Then the expected response 

  • Example: Display screen, update data 

When multiple steps need to be executed, we can use the ‘and’ with the Given, When or Then. 

Given:  

Account-type = ‘Active’ and ‘Pay Monthly’  

and Contract Date >= 9 months old  

When:  

Select ‘Can this phone be upgraded’ button 

Then:  

Display ‘You are eligible for an upgrade’ 

‘Click here to go to Product Page’ 

Show button ‘Products’ 

Many tools are available to take this GWT format and convert to automated tests, such as Selenium and Cucumber. 

When you are ready, select Next to continue. 

Difficulty
Beginner
Duration
54m
Students
1
Description

This section discusses the testing practices that can be followed in every development project (Agile or not) to produce quality products. Testers in Agile projects play a key role in guiding the use of these testing practices throughout the lifecycle. 

About the Author
Students
27161
Labs
122
Courses
1291
Learning Paths
45

A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.