Data Driven Testing

37
© 2015 Maveryx srl. All rights reserved. Data-Driven Testing

Transcript of Data Driven Testing

Page 1: Data Driven Testing

© 2015 Maveryx srl.

All rights reserved.

Data-Driven Testing

Page 2: Data Driven Testing

� What is Data-Driven Testing

� How to Create Data-Driven Tests

� Data-Driven Testing by examples

Overview

Page 3: Data Driven Testing

What is Data-Driven Testing

Data-driven testing: a scripting technique that stores test input

and expected results in a table or spreadsheet, so that a single

control script can execute all of the tests in the table.

[ISTQB – Glossary Standard Glossary of Terms used in Software Testing Version 2.4]

In the simplest form the tester supplies the inputs from a row in

the table and expects the outputs which occur in the same row.

The table typically contains values which correspond to

boundary or partition input spaces.

[Data-driven testing, From Wikipedia, http://en.wikipedia.org/wiki/Data-driven_testing]

Page 4: Data Driven Testing

On Data-Driven Testing

� Data-driven testing is a testing methodology where

test input and output values are read from data files

and are loaded into variables in the test scripts

� Data-driven testing allows executing the same test

(or tests) multiple times with different set of data

� Test input and output verification data values are

separated from the test code

Page 5: Data Driven Testing

On Data-Driven Testing

� Test data can be stored in one or more central data

sources, such as external files (xls, csv, xml, …) or

databases

� Data-driven testing is used generally for applications

requiring fixed set of actions to be performed, but

with a lot of permutations and combinations of the

various parameters which form the test cases

Page 6: Data Driven Testing

Pros & Cons

Advantages of data-driven testing /1

� Test Data can be designed while application development is in

progress

� Clean separation of Test Case and Test Data

� Changes to the Test Case/Scripts do not affect the Test Data

� Only the script representing a “business function” needs to be

modified in case of any change in functionality

Page 7: Data Driven Testing

Pros & Cons

Advantages of data-driven testing /2

� Repeatability and Reusability

� the same tests can be executed several times with multiple

sets of data

� Reduction in Number of Test Cases/Scripts

� Data-driven Scripts result in less amount of code

Page 8: Data Driven Testing

Pros & Cons

Disadvantages of data-driven testing

� Quality and coverage strongly depends on the automation skills of

implementing person

� Data validation is required.

� [Manual testing for] data validation process is time consuming,

particularly when testing large pools of data

� Continuous maintenance issues due to a big amount

of code

Page 9: Data Driven Testing

How to Create Data-Driven Tests

Common Steps involved in Data driven Testing:

1. Create a test script with a set of constant test data

2. Replace constant test data with some variables

3. Create multiple sets of test data in a data storage (e.g. Excel,

CSV, XML, ...)

4. Assign to variables the values read from the data storage

Page 10: Data Driven Testing

Architecture of Data-Driven Tests

A data-driven test includes the following operations performed

in a loop:

1. Retrieving input data from storage

2. Entering data in the application–under–test

3. Verifying the results

4. Continuing with the next set of input data(*)

(*) Every set of input data delivers the data for a different test case.

Page 11: Data Driven Testing

The example application

Passwords shall use the following types of characters:

• Lowercase• Uppercase• Numbers

No special characters such as !@#$%^&*(){}[].

Page 12: Data Driven Testing

The Test Tool – Maveryx

Maveryx is a

professional, test

automation tool for

functional and

regression testing of

Java™ & Android™

applications.

Page 13: Data Driven Testing

Architecture of the Test Scripts

With this configuration there are multiple variations that must be tested:

Test Script

1. Enter username

2. Enter Password

3. Click "Login" button

4. Verifying the results

5. Click “OK" button

Page 14: Data Driven Testing

The Test Script

Test Script

1. Enter username

2. Enter Password

3. Click "Login" button

4. Verifying the results

5. Click “OK" button

Page 15: Data Driven Testing

Data-Driven Testing Step #1

1. Create a test script with a

set of constant test data

2. Replace constant test data

with some variables

3. Create multiple sets of test

data in a data storage (e.g.

Excel, CSV, XML, ...)

4. Assign to variables the value

that is read from the data

storage

Page 16: Data Driven Testing

Data-Driven Testing Step #2

1. Create a test script with a set

of constant test data

2. Replace constant test data

with some variables

3. Create multiple sets of test

data in a data storage (e.g.

Excel, CSV, XML, ...)

4. Assign to variables the value

that is read from the data

storage

Page 17: Data Driven Testing

Data-Driven Testing Step #3

1. Create a test script with a set

of constant test data

2. Replace constant test data

with some variables

3. Create multiple sets of test

data in a data storage (e.g.

Excel, CSV, XML, ...)

4. Assign to variables the value

that is read from the data

storage

Page 18: Data Driven Testing

Data-Driven Testing Step #4

1. Create a test script with a set

of constant test data

2. Replace constant test data

with some variables

3. Create multiple sets of test

data in a data storage (e.g.

Excel, CSV, XML, ...)

4. Assign to variables the value

that is read from the data

storage

Page 19: Data Driven Testing

Anatomy of the Test Script /1

1. Manage Data Sources

2. Retrieve input data

from storage

3. Enter data in the

application-under-test

4. Verify the results

5. Continue with the

next set of input data

Create a data manager using the constructor provided

by the TestDataManager class.

ExcelCSV

XML

Page 20: Data Driven Testing

Anatomy of the Test Script /2

1. Manage Data Sources

2. Retrieve input data

from storage

3. Enter data in the

application-under-test

4. Verify the results

5. Continue with the

next set of input data

Retrieve the data at the specified i-ndex of the column “Username”.

Page 21: Data Driven Testing

Anatomy of the Test Script /3

1. Manage Data Sources

2. Retrieve input data

from storage

3. Enter data in the

application-under-test

4. Verify the results

5. Continue with the next

set of input data

Page 22: Data Driven Testing

Anatomy of the Test Script /4

1. Manage Data Sources

2. Retrieve input data

from storage

3. Enter data in the

application-under-test

4. Verify the results

5. Continue with the

next set of input data

Page 23: Data Driven Testing

Anatomy of the Test Script /5

1. Manage Data Sources

2. Retrieve input data

from storage

3. Enter data in the

application-under-test

4. Verify the results

5. Continue with the

next set of input data

Page 24: Data Driven Testing

Run the Test

Page 25: Data Driven Testing

Lessons Learned

1. Data-Driven Testing allows writing the test cases as scripts

that read their data from external files, instead of using the

same hard-coded values each time

2. By this approach there is only 1 script to drive the tests but by

changing the data testers can create any number of test

cases

Page 26: Data Driven Testing

Lessons Learned

3. With Maveryx you can separate test logic from test data.

Maveryx supports the most popular external sources

4. A good data-driven test script :

1. Read test data from the data storage

2. Input the data into the application-under-test

3. Verify the results

4. Continue with the next test data

Page 27: Data Driven Testing

© 2015 Maveryx srl.

All rights reserved.

About Maveryx…

Page 28: Data Driven Testing

Maveryx is a professional, award-winning test automation tool for

functional and regression testing of Java™ & Android™ applications.

Maveryx provides testers with automated testing capabilities for

functional, regression, GUI, data-driven and keyword-driven testing.

Maveryx

Page 29: Data Driven Testing

� No GUI Maps

� Intelligent Objects Recognition

� Data-driven testing

� Keyword-driven Testing

� Assertion-based CheckPoints

� Distributed testing

� Single tool for Java & Android

� Standard Test Logging

� Built on Java & JUnit

� Advanced Test API

� Test Data Generation Tool

� Extension plugins

� Eclipse plugin

� Android ADT plugin

� …

Key Features

© 2014 Maveryx srl.

All rights reserved.

Page 30: Data Driven Testing

No GUI Maps

No Recording. No Object Spy. No Object Maps. Nothing.

o No GUI MAP needed to create and run the test scripts

o No Object Repository to learn & maintain, maintain, maintain…

o No pre-recording or screen capture

o Independent of screen coordinates and resolutions

⇒ Test scripts immediately executable!

Page 31: Data Driven Testing

o A.I. Artificial Intelligence. Advanced Searching Algorithms to identify

UI objects directly at runtime during test execution, like humans do..

o Automatically accommodate UI changes without changing the scripts

o “Geolocation” of objects in the User Interface (TOP, BOTTOM, LEFT, RIGHT, UP,

DOWN, NEAR-TO …)

Intelligent Objects Recognition

© 2014 Maveryx srl.

All rights reserved.

TOP

BOTTOM

L

E

F

T

R

I

G

H

T

CENTER

Page 32: Data Driven Testing

o Code-free Keyword-driven Testing

o Keyword testing driven from Excel™ sheets and XML files

o No coding required ⇒ short time to implement test scripts

o Data-driven testing

o Dedicated scripting API for data-driven testing

o Varying set of data sources : Excel™ sheets , CSV & XML files

Codeless Test Automation

© 2014 Maveryx srl.

All rights reserved.

Page 33: Data Driven Testing

© 2014 Maveryx srl.

All rights reserved.

“One Script” Technology

Write Once, Run Many. Maveryx allows

creating scripts that can be run without

modification against any Android apps,

as well as Java desktop applications on

all platforms.

Page 34: Data Driven Testing

o Tests can be executed on Android Virtual Devices (AVDs) or Real

Devices ⇒No Rooting!

o devices connected to the local PC [via USB cable or Wi-Fi]

o devices connected remotely to a mobile device lab

o Support for all versions of Android

o Support for almost all UI Elements

o …

© 2014 Maveryx srl.

All rights reserved.

Mobile Testing

Page 35: Data Driven Testing

The industry like us

Winner.

© 2014 Maveryx srl.

All rights reserved.

Page 36: Data Driven Testing

Useful Links

o Maveryx – http://www.maveryx.com

o User guide – http://www.maveryx.com/en/support/learn-

more/user-documentation.html

o Forum – http://www.maveryx.com/en/forum/index.html

o Training – http://www.maveryx.com/en/services/training.html

Page 37: Data Driven Testing

Thank You!

• www.maveryx.com

[email protected]

[email protected]