Test Your ASP Apps with VSTS Web Tests and Load Tests.ppt
《Test Your ASP Apps with VSTS Web Tests and Load Tests.ppt》由会员分享,可在线阅读,更多相关《Test Your ASP Apps with VSTS Web Tests and Load Tests.ppt(46页珍藏版)》请在麦多课文档分享上搜索。
1、Test Your ASP.NET Apps with VSTS Web Tests and Load Tests,Benjamin Day http:/ http:/,About the speaker,Owner, Benjamin Day Consulting, Inc. Email: Web: http:/ Blog: http:/ Trainer Visual Studio Team System, Team Foundation Server Microsoft MVP for VSTS Microsoft VSTS/TFS Customer Advisory Council M
2、icrosoft Cloud Services Advisory Group Leader of Beantown.NET INETA User Group,What is a Web Test?,Unit test for exercising and validating an ASP.NET application Collection of web requests Typically represents a scenario through the web app Probably not a great candidate for Test-First Development V
3、alidation Rules to check the returned web page Extraction Rules extract values from a returned page for use in other parts of the test Recorded or coded Can be data-driven Building block for Load Tests,Demo: Create a basic WebTest,What can you add to a web test?,ASP.NET UI Requests Requests to a web
4、 page WebService Requests Microsoft says “Request to a web service” In reality, more like a chunk of text passed to an HTTP address Comments Transactions A subset of the web tests requests grouped together by name Used to get timing information portions of the test Calls to other web tests New for V
5、S2008,What can you add to a request?,HTTP Header Add a header and a value URL Query String Parameter POST Parameter File Upload Parameter Dependent Request(s) Request embedded into the page like an image () request By default, dependent requests are parsed and issued at runtime according to the Resp
6、onse Adding a dependent request forces a certain request to be made,Parameterization,Use context values to drive your requests and validations Minimizes hard coding Web server addresses for requests can be parameterized Parameterized values are stored in the test context Reference the values using d
7、ouble “squiggle bracket” syntax variable_name Allows you to pass in values from load tests Essential for data-driven web tests,Data-Driven Web Tests,Use an external data source to run your web test OLE DB source CSV XML Helps simulate multiple users Enables much more thorough tests Easy to do more c
8、omplex tests,Code Demo,Create a basic data-driven web test,Data-Driven Test Gotchas / Fixes,Sources are challenging to modify File-based (CSV, XML) use hard-coded paths Database connection string can only be replaced not modified Problem: what if your devs dont all have the same working directories?
9、 Problem: paths different during automated builds Problem: database might be different during automated builds Fixes: Reference file-based sources through a network share localhostWebTestDatasources Option: Adjust your “hosts” file C:WindowsSystem32driversetchosts Reference databases using “Trusted
10、Connection=true”,Data-Driven Web Test Best Practices,You should always be able to use version control to re-create a point-in-time version of your app This includes your unit tests If your tests are data-driven then the data source needs to be version controlled, too! You should be able to compile y
11、our app and run ALL the unit tests from an automatic build (continuous integration),How to get test data without much effort,Create a “DB Pro” project Visual Studio Team System 2008 Database Edition defines the structure of the database Option #1: Use a Test Data Generation Plan Option #1a: Put the
12、test data into a database and script it to a CSV Option #1b: Reference the test data directly in the database Option #2: Use “Post Deploy” Scripts to populate the database Database is your data source Compile / Deploy the database You can populate test data tables the database using “Post-Deployment
13、 Scripts” as part of the database “build”,Test Data Regular Expressions,Names: A-Zaeioua-z* Email Addresses: a-z0-9*a-z0-9*.(com|org|net|co.uk) Phone Numbers: (0-93)-0-93-0-94,Code Demo,Generate test data with DBPro Use SQL Server Management Studio to export to CSV Put CSV on a share Modify data sou
14、rce to reference the share,Web Test Properties,Stop On Error If true, the test stops running at the first error Default value is false User Name, Password Credentials for the request Basic auth or Windows Integrated auth Description Proxy Address of a proxy server for this request PreAuthenticate Se
15、nd the authentication in the header True, False,Request Properties,Url Url for the request Follow Redirects Method GET or POST Parse Dependent Requests Look for things like tags, style sheets requests, and download them Encoding Character format for the request Default is UTF-8,More Request Properti
16、es,Cache Control True = use locally cached version (IEs “Automatic” setting) False = Always download Think Time (seconds) Emulate a human reading/consuming the web page Timeout (seconds) How long before this request should fail? Record Results Record performance counter data when run from a load tes
17、t,Still More Request Properties,Version Version of HTTP to send: 1.0 or 1.1 Expected HTTP Status Code Default value = 0 200, 300 = OK 400, 500 = Error Expected Response URL,Validation & Extraction Rules,Rules,Validation Rules Check values in the response Can be “Global” to the web test Per request E
18、xtraction Rules Pull values from the response Put them into the Test Context for use in other requests,“Out of the box” Validation Rules,Form Field Validate a field for an expected value Field = Find Text Find a string anywhere in the Response Maximum Request Time Execution time in milliseconds Requ
19、ired Tag Html tag exists n times in the response Required Attribute Value Html tag exists with the expected attributes and values Response URL URL (after redirects) is same as during the recorded test,“Out of the box” Extraction Rules,Pull values from the response Test Context Extract Attribute Valu
20、e Extract Form Field Extract HTTP Header Gets the value for an HTTP Header Extract Regular Expression Use a regex to pull a value from the response Extract Text Using StartsWith and EndsWith Extract Hidden Fields,“Out of the box” rules are underwhelming,Not a bad starting point Missing some function
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- TESTYOURASPAPPSWITHVSTSWEBTESTSANDLOADTESTSPPT

链接地址:http://www.mydoc123.com/p-373208.html