Data Binding A Web Test                                                                        
•        Data can be fed to a web test to change parameters passed into a web application. This is call “data
binding”.
-        For example, this data can come from a table in a database.
-        You can also bind your web tests to a text file. Optionally, you can also use an XML schema file to
describe the data.
-        This can be helpful in testing your web application by querying many different records that would
normally have to be typed in by hand.
•        To add a data binding to a web test, you first need to create a web test based on the page that you wish
to feed data to.


-        Here is the web page that you are going to run in the test.
-        As you can see, you are entering the author ID into the textbox at the top author information is being
displayed in all the text boxes below.
•        You performed three web requests (see below) in the test:
-        The first request initially loads the page.
-        The second request posts an author ID and retrieves the author’s details.
-        The third request also posts an author’s ID for that author’s details.
•        Here is the complete recorded test:


-        You can see all three tests requests above.
-        Keeping the Server Explorer window open helps identify the table and column names to be used in the
test later on.
•        You are going to add a data source to our project by clicking on the “Add Data Source” toolbar button.



•        Once clicked, you need to choose a data connection source. Because you are using SQL Server, choose
SQL Native Client.


•        You also need to choose which table(s) you will be feeding the data from.
-        Here, you are choosing the authors table, since you will be feeding the test “au_id “.



•        As you can tell, the data source is now added to the web test project.

•        All that is left to do is assign the au_id column to the web test requests.
-        Notice that when you navigate to the author id that was posted to the web server, the Properties
window awakens and shows you the data.
              

-        You could either hard code your own values here or, better yet, choose one of the columns from the
“authors” table.

•        Technically, you do not need the third web request in this web test, so delete it.


-        This third request would is redundant.
•        Next, you need to change the “test run configuration” to allow one request per data row.
-        In the Solution Explorer window, double-click “localtestrun.testrunconfig” to make this change.
-        On the left side of the dialog, click on Web Test and select “One run per data source row”. Note that
you can also simulate “Think Times” of a web user.

•        Run the test! When you execute the test, it will perform all web requests recorded.
-        For example, you have two separate web requests recorded.
-        These two requests repeat for every row in the authors table of the pubs database.
-        Specifically, the second request will POST the author ID (au_id) to the web server to retrieve author
information.
•        Looking at the results, you can see how one of the web pages was processed by merely selecting a
request.


-        In the picture above, you can see the details of the second request in Run 23. Note that Albert Ringer’s
details are displayed below. Cool, huh?
-        Be sure to click on the other tabs to see the details of the Request, Response, etc.
Data Binding Web Test
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials