Binding Data to Web Performance Tests
page 2 of 3
by Steven Smith
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 19761/ 60

Create the Test Project and Web Test

Open Visual Studio 2010 and create a new Test Project and then record a new Web Performance Test.

When the browser opens as part of the recorder, go to your favorite search engine, and search for something.  Then stop the recording and wait while Visual Studio detects dynamic parameters.  Depending on the search engine you're using, you may end up with a fair number of requests (due to various images as well as AJAX script callbacks) in your recording.  Find the one that corresponds to your actual search request and delete the others. 

 

For our test data, we're going to use a simple text file.  Go to your test project and add a new file.  Name it SearchTerms.csv.  Add three rows of text to the file and save it:

Term
one
two
three

Next, in the QueryString Parameters of your search request, click on the term you searched for and then inspect its properties.

From the dropdown beside the Value's value, choose Add Data Source.

The simplest way to add data to your test is to create a comma-separated file and include it in the test project.  We'll use this approach for now, but certainly you could also store the test data in an actual database.  Name the data source 'search terms', and click Next.

Next, select your SearchTerms.csv file from your test project.  You should see it added to your Web Test like so:

Now go back to your query parameter (in my case, q=aspalliance) and inspect its properties.  When you look at that value, you should have the option to replace it with an item from the data source.

Choose the Term from the CSV file.  Finally, delete all of the other QueryString parameters except for your term, so it should look like this:

Now you're ready to run the test.  You should see results like this:

 

Notice that we searched for our first search term, 'one'.  But wait, we only did one search - I thought the whole data file thing was meant to let us run many different cases?  So it is.  The last step is to click on the Edit run settings link above.  Click the One run per data source row option:

Now run the test again - you should get three test runs.  You can inspect each one to see the parameters that were passed in, as you can see the 'three' shown here:

You can edit your test run settings in your .testsettings file, which you'll find in your Solution items by default (e.g. Local.testsettings).  Under Web Test you'll find the setting to run the web tests once per data row:

 

 


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-04-19 2:50:09 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search