07.11.2014 Views

Enterprise Library Test Guide - Willy .Net

Enterprise Library Test Guide - Willy .Net

Enterprise Library Test Guide - Willy .Net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Test</strong>ing for Performance and Scalability 181<br />

Extract);<br />

request1.ThinkTime = 13;<br />

ExtractHiddenFields rule1 = new ExtractHiddenFields();<br />

rule1.ContextParameterName = "1";<br />

request1.ExtractValues += new EventHandler(rule1.<br />

yield return request1;<br />

Web<strong>Test</strong>Request request2 = new Web<strong>Test</strong>Request("http://localhost/<br />

entlibtests/caching.aspx");<br />

request2.Method = "POST";<br />

FormPostHttpBody request2Body = new FormPostHttpBody();<br />

request2Body.FormPostParameters.Add("__VIEWSTATE", this.<br />

Context["$HIDDEN1.__VIEWSTATE"].ToString());<br />

request2Body.FormPostParameters.Add("TextBox1", this.<br />

Context["DataSource1.cache#csv.cacheitem"].ToString());<br />

request2Body.FormPostParameters.Add("TextBox2", "2000");<br />

request2Body.FormPostParameters.Add("DropDownList1", "0");<br />

request2Body.FormPostParameters.Add("DropDownList3", "DefaultCacheManager");<br />

request2Body.FormPostParameters.Add("DropDownList2", "0");<br />

request2Body.FormPostParameters.Add("Button1", "Add Item");<br />

request2Body.FormPostParameters.Add("__EVENTVALIDATION", this.<br />

Context["$HIDDEN1.__EVENTVALIDATION"].ToString());<br />

request2.Body = request2Body;<br />

yield return request2;<br />

}<br />

}<br />

}<br />

Each test iteration uses a different cache store. If you want to use only one of the<br />

cache stores, remove the other entry from the data source. Data binding is particularly<br />

useful for stress tests, where you want to test all of the scenarios. Bind every Web<br />

control to a data source to create a Web test with full coverage.<br />

Defining the Workload Profile<br />

The workload profile consists of an aggregate mix of users simultaneously performing<br />

various operations. This profile should yield the same results over multiple test<br />

runs. A workload profile consists of an aggregate mix of users simultaneously performing<br />

various operations. To create a workload profile, decide the number of users<br />

you will simulate, how the operations the users perform will be distributed in terms<br />

of percentages, and how much think time you will allow between operations. Think<br />

times simulate behavior that causes people to wait between interactions with a Web<br />

site. They should occur between requests in a Web test and between test iterations in<br />

a load test. Including think times in a load test can be useful in creating more accurate<br />

load simulations. In Visual Studio 2005 Team Edition for Software <strong>Test</strong>ers, think<br />

times are measured in seconds. (The <strong>Enterprise</strong> <strong>Library</strong> tests do not use think times<br />

because they do not have to simulate that type of user behavior.)<br />

Create a workload profile when you have to prove that an application block can concurrently<br />

execute a variety of scenarios. The Caching Application Block performance

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!