Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
32 views66 pages

Data-Driven Testing

The Provar Automation Essentials course on Data-Driven Testing teaches participants how to utilize data-driven testing features in automation, focusing on benefits, execution, and parameterization. The course includes lessons on adding parameter value sources, looping through data, and using UI Fill to streamline test cases. Completion of the course earns a badge and is recommended to be taken sequentially with other courses in the certification program.

Uploaded by

Nataraj N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views66 pages

Data-Driven Testing

The Provar Automation Essentials course on Data-Driven Testing teaches participants how to utilize data-driven testing features in automation, focusing on benefits, execution, and parameterization. The course includes lessons on adding parameter value sources, looping through data, and using UI Fill to streamline test cases. Completion of the course earns a badge and is recommended to be taken sequentially with other courses in the certification program.

Uploaded by

Nataraj N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Provar Automation Essentials: Data-Driven Testing

Course Contributor: Clint Daniel


Course Designer: Caroline Smith

The purpose of this course is to explain the features for data-driven testing in Automation.

NOTE: This course is one of Provar Automation Essentials and is best taken in sequence with
the other courses in that certification. You can find it under the Certifications tab from your
home screen in UP.

INTR ODUC TION

Getting Started

Terms to Know

DATA-DR IVEN TES TING

Introduction to Data-Driven Testing

Add a Parameter Value Source

Loop Through Data

UI Fill
WR AP UP

Quiz

Summary & Badge

Course Transcript

Tell us what you think!


Lesson 1 of 10

Getting Started

By the end of this course, you will be able to. . .

explain the benefits of data-driven testing

execute data-driven testing in Automation

This course should take about 45 minutes, and you will earn a Provar Automation Essentials: Data-Driven
Testing badge upon completion.
Lesson 2 of 10

Terms to Know

We'll cover these terms throughout the course, but take a moment to review each of them here first.

Hard-Coded Values

A hard-coded value is a set value. It should be avoided because it can lead to difficult maintenance or
failures.

Parameters

Parameters are variables that put into your test case. They can change and populate the test case with
different data.

Parameter Value Source



A file of data that you load into a test
For Each

A test step available in the Test Palette that executes the steps for each row of data in a record

UI Fill

UI Fill reads a file of data that you create and matches the column headers with Salesforce metadata

Org Browser

A feature of Automation that shows the currently cached metadata for a Salesforce connection
Lesson 3 of 10

Introduction to Data-Driven Testing

What is Data-Driven Testing?


Data-driven testing is a test design and execution strategy where the test scripts read test data from data
sources. Flip through the cards below for just a few scenarios that show how data-driven testing is helpful.

When you need to perform


multiple calculations on your data,
Increase efficiency
use Excel as a method of deriving
the fields
Loop through data sets when
Reduce redundancy you have multiple data
permutations

Use different input parameters


Improve coverage to test positive and negative
scenarios

Automation is ready to help you and your team take advantage of data-driven testing with just a few clicks. It
supports several file types.

CSV

JSON
EXCEL

Database Query Results


Lesson 4 of 10

Add a Parameter Value Source

Hard-Coded Values vs. Parameters


A hard-coded value is a set value. This means that every time you run a test step with a hard-coded value,
the test will expect that specified value to pass the step. Using hard-coded values can lead to unnecessary
failures or difficult and time-consuming maintenance on your test cases. One solution for this is to use

parameters, or variables, that can change and populate the test case with different data. We've already
parameterized our Create Lead test case, so let's review those steps in the Test Canvas.


Set Values

We set the values for first and last names as a group step at the beginning of the test case. This allows us to
reference the variables throughout it.

Parameterized Test Steps

Using Content Assist, we called the first and last name variables for these test steps.

In the rest of this course, we'll look at other options for making your tests dynamic with data-driven testing.
Note that we will use this test case above as the starting point in other lessons. Before modifying it here, we

recommend making a copy of it in your tests folder.

Parameter Value Source


Another solution for hard-coded values is to add a parameter value source. Instead of manually updating the

value on each step, you can create a file of data to load into the test. This will populate all the data in the test
case where there are values that can be parameterized. You can add a parameter value source on any test
step, but it should be used with the Group Step command for readability. Recall that Automation supports
CSV, JSON, Excel, and database query results as source files. Let's see how this works in a test case.
Add a Parameter Value Source
Step 1

Configure your parameter value source

We'll use an Excel file in our example. Note the tabs and columns in it. The headings you enter are
how you refer to the field. They do not have to match the field name exactly, but it makes sense to
name them close to the field name. For example, you could use FName instead of
FirstName. Make sure there are no spaces in your header names. Add the values under each
header.
Step 2

Save the file to the templates folder

After setting up your file, you need to make sure to save your file in the templates folder of the
project in the Navigator. When saving the file, you can navigate directly to this folder or save it
elsewhere and drag and drop it into Automation. You can also drag and drop the file from your
desktop into the templates folder in Automation.

It is important to keep all your source files in the templates folder, especially when you are sharing
projects. If you share a project and your source files are located somewhere else, the tests will fail
as soon as someone else runs them because the source files are missing from the project.

Save the file and name it something descriptive. We'll call it LeadData.
Step 3

Add a test step with Group Steps

Now we need to add a test step to read in the data source. Go to the Test Palette and go to Group
Steps.
Step 4

Add the Group Steps to the Test Canvas

Drag the Group Steps from the Test Palette to the Test Canvas. The black line will tell you where it
will be added in the test case. Drop it underneath your Salesforce connection.

Note that this test case still has hard-coded values. Remember that we are parameterizing it with
a parameter value source.
Step 5

Add a description

Enter Setup Test Data for the Description.


Step 6

Add a new parameter value source

In the top right of the test step, click the icon to Add a New Parameter Value Source.
Step 7

Populate your values

The default source type should be Excel. If you open the menu, you can see the source types that
Automation supports. The settings change based on the selected source type.

Choose the file type from the drop-down menu and click the folder icon to choose the file.
Because the file is in the templates folder, Automation will open the templates folder
automatically.
Step 8

Configure test step parameters

Configure your values to match those shown in the test step parameters. Now our Excel sheet
will read in our data.

Note the field for a Where clause. This will allow you to set a where clause to only pull rows that
meet some set criteria. You can also choose additional options for Case Sensitivity, Debug, and
Preserve Heading Case.

The Variable field defaults to SourceData. This will be the name you refer to whenever calling
these values. You can change this name to anything you wish.
Step 9

Change the editor for the Salutation field

Now that the data is loaded, we need to call those values into the test steps. The first field we
need to update is the Salutation field, so let's go to that test step. Recall that because of the
metadata connection, Automation automatically knows the field types. In this case, it knows that
the Salutation is a picklist. To allow us to use the source data, we need to change the choice
editor to an expression editor.
Step 10

Call the value for the Salutation field

Now that we’ve got the right editor, we need to call our value. Press Ctrl+spacebar to open
Content Assist and select SourceData variable that is now available.
Step 11

Finish the expression

Now let's dictate the row where Automation needs to start. By default, Automation reads in the
first row, which is all we have in this data set. Use bracket notation to tell it to read the Salutation:
{SourceData.Salutation}. The period after the SourceData will open a menu to select Salutation.

Repeat the same steps for FirstName, LastName, and Company.


Summary

Now your test will pull from the source file that you provided. If you want to change the data, you
can do so all in one place.
Lesson 5 of 10

Loop Through Data

Load Multiple Records


In the previous section of this course, we saw how to use a file to load data into a test for a single record. To
increase efficiency, Automation allows you to loop through rows of a spreadsheet to iterate upon the data.
This means that the same actions will be performed for every row in the spreadsheet. By using a single test
case for many input parameters, you can save time and minimize errors. Let's get started by adding more
data to our LeadData.xlsx file.

With the rows added, we need to update the test to account for them. In order to make the test run through
all the records, we need a test step that will loop through the new rows we added. The For Each step in the

Test Palette allows us to execute the steps for each record. Let's see how to add it.
Looping Through Data
Step 1

Add the For Each step

Drag For Each step from the Test Palette.


Step 2

Drop the For Each step

Drop the For Each step above the On SF Lead New screen step.
Step 3

Add the Source Data

Now that we have the For Each step added to the test, we need to fill in the required fields. The
first field is the List field. Our list (LeadData.xlsx) is already loaded, so use Content Assist to add
SourceData as the list.
Step 4

Configure test step parameters

Now that we've provided the list of records, let's look at the other fields.

From Item tells the loop we're starting with the first record

Value Name field is the name used to refer to each row of data

Continue on Failure will keep looping through rows even if one iteration fails

Since we're referring to rows of data, let's call this Row for the value name.
Step 5

Call the value name in your test steps

Before running the test, we need to update the steps that refer to our rows. In the For Each
settings, we provided the Value Name as Row. Now we can call it in the test steps we want to
loop. Let's start with the Salutation step. Use Content Assist to call Row for the value.
Step 6

Use dot notation

Now let's use dot notation to specify that it is the salutation. Once you add the period after Row, a
list should appear that allows you to click Salutation.
Step 7

Repeat for the rest of the steps

Update the other steps under For Each with the Row variable and the dot notation for the correct
field. When you are done, your test case should look like the image above.
Step 8

Parameterize assertion step

Before finishing the test, check to make sure that the assertion step also has parameters. In this
example, you can see that the operator for the Name field has been changed to Contains, and the
value has the parameter {Row.FirstName}.
Summary

Repetitive processes are good candidates for looping. Load multiple records and loop through
their data to make your tests more dynamic and efficient.
Lesson 6 of 10

UI Fill

Fill in Values from Metadata


So far, we've parameterized test cases by using variables and by adding a parameter value source. We've
also added multiple records to an Excel spreadsheet to loop through data. In this section, we'll look at a test
step in Automation called UI Fill. UI Fill reads a file of data that you create and matches the column headers

with Salesforce metadata. This means Automation will fill in everything, so you don't have to even map the
steps.

Check out the test case below. It should look familiar because it was where we started with hard-coded
values when we added a parameter value source. We know that this test will create a lead and verify some

values on the view screen.


It's a short test case, so updating the hard-coded values might not seem daunting here, but we know most
test cases are larger than this. UI Fill can help us manage them. The first step is to set up the file. When
setting up these files, it is very important to check your metadata to make sure your headers match, or else
the field will not be filled out. Don't worry, though, because Automation's Org Browser will help us. It shows
the currently cached metadata for a Salesforce connection
Match a File to the Metadata
Step 1

Start with a file of data

Similar to when we added a new parameter value source, the first step here is to start with your
file. We'll use the same one.

We are using Excel for our examples, but remember that Automation also supports CSV, JSON,
and database query results.
Step 2

Go to the Org Browser

Now it's time to check how our column headers (Salutation, FirstName, LastName, Company)
appear in the metadata. We'll go to the Org Browser for this.
Step 3

Find the Lead Object

Type lead into the filter to navigate to the Lead object. Click the caret next to Fields to expand it
and view all the field names. This is how they appear in the metadata.
Step 4

Find Salutation

Find Salutation in the list and you’ll see that Salutation is the right field name. We can see that
ours matches the metadata.
Step 5

Check other fields

Scroll to find how the first name, last name, and company appear in the metadata. When you
have checked all your names, your file should look like the image above.

This matches our original file names, but it is necessary to check each time you create one.
Otherwise, your test might fail with headers that don't match the metadata.
Summary

Your file is set up. Save it and let's see how to use it with UI Fill!

We need to save the file to the templates folder in the project. You can save it directly there or drag and drop
it into Automation. Either way, remember that it is important to keep all of your source files in the templates
folder, especially when you are sharing projects. Let's save it as LeadUIFillData.
With the file in the templates folder, it's time to add it to our test. To do this, we'll add a new parameter source.
We've already gone through a similar process, but you can review the steps for this test case below.
Add a New Parameter Value Source
Step 1

Add a Group Step

When adding a new parameter value source, it's a best practice to add it as a group step. This
makes it easy to find. Let's add it from the Test Palette and give it a descriptive name. We'll call
it Read Excel File.
Step 2

Add a New Parameter Value Source

From the description for the group step, click the Add a New Parameter Value Source icon.
Step 3

Choose the file

Remember that Automation defaults to Excel for the file type, but you can select the correct file
type from the drop-down menu. Click the folder icon to choose the right file.
Step 4

Configure the parameters

Review the settings for the file.

The Where clause allows you to set a where clause to only pull rows that meet some set
criteria.

Case Sensitivity, Debug, and Preserve Heading Case are additional options.

The default Variable name is SourceData. Let's change ours to UIFillData. This is the name
we'll refer to whenever we call these values.
Summary

Your source file is added and ready to be used.

Now that we've added the source file, it's time to use it in our test case. Note that if you ever want to change
the data or add new fields, you can do it all in one place. Just make sure you match the field names with how
it appears in the metadata. Now let's see how to use the data with the UI Fill step.
Add the UI Fill Step
Step 1

Delete test steps

Because the UI Fill is going to do the work for us, we need to delete the Salutation, First Name,
Last Name, and Company test steps. Confirm the deletion in the pop-up window.
Step 2

Add the UI Fill Step

Drag the UI Fill step from the UI section of the Test Palette. Drop it into your test case above the
Save step under On SF Lead New screen.
Step 3

Add test step parameters

UI Fill only has two parameters: Values and Ignore Fields. Values is the field where you tell the UI
Fill where to read from. Open Content Assist to add the UIFillData file.

Now Automation wants to know if we want to ignore any fields. Since we don’t but it’s a required
field, we can type whatever we want here as long as it doesn’t match one of our fields.
Summary

That's it! Now we've added the UI Fill step to our test case. When it runs, we'll see that the UI Fill
step uses the values in the file to automatically fill out the Salutation, First Name, Last Name, and
Company.
Lesson 7 of 10

Quiz
Question

01/05

Where should you store data files used for data-driven testing?

templates folder

src folder

Settings

tests folder
Question

02/05

Which feature of Automation allows you to perform data loading?

Add a Data File

SetSourceData

Set Values

Add a New Parameter Value Source


Question

03/05

Which of the following file types does Automation support?

CSV

JSON

Excel

Database Query Results

All of the above


Question

04/05

When adding a parameter value source, it is recommended that you add it as a Group Step.

True

False
Question

05/05

Which command from the Test Palette reads a file of data that you create and matches the
column headers with Salesforce metadata?

For Each

UI Fill

Group Steps

Set Values
Lesson 8 of 10

Summary & Badge

Congratulations on completing the Provar Automation Essentials: Data-Driven Testing course.

You should now be able to. . .

explain the benefits of data-driven testing

execute data-driven testing in Automation

You've also earned a Provar Automation Essentials: Data-Driven Testing badge. Click "My Learning"

on the UP homepage to locate your new badge!


Lesson 9 of 10

Course Transcript

File Attachment Block


No file added
Lesson 10 of 10

Tell us what you think!

Tell Us What You Think!


Congrats on completing this course! If you have a few moments, we'd love to get your
feedback on how we can make this course and the University of Provar better.
Name (Required)

First

Last

Email (Required)

What course are you providing feedback for? (Required)

You might also like