Are Your Teams Writing Quality Code

26
1 Are Your Teams Writing Quality Code? Ervin Loh Microsoft MVP Email: [email protected] Blog: http://ervinloh.spaces.live.com/

Transcript of Are Your Teams Writing Quality Code

Page 1: Are Your Teams Writing Quality Code

11

Are Your Teams Writing Quality Code?

Ervin LohMicrosoft MVPEmail: [email protected]: http://ervinloh.spaces.live.com/

Page 2: Are Your Teams Writing Quality Code

22

You reached the final mile before facing the real world. Learn how Visual Studio Team System assist you in detecting potential performance problems before you deploy your application to the real world.

Scenario

Page 3: Are Your Teams Writing Quality Code

33

Agenda

Overview of Web Tests

Overview of Load Tests

Interpreting Test Results

Test Case Development

Page 4: Are Your Teams Writing Quality Code

44

Overview of Web Tests

What Are Web Tests?

What Is the Importance of Web Tests?

How Web Tests Are Created

How Web Tests Are Run

What Are Validation and Extraction Rules?

Demonstration: How to Verify Web Tests

Demonstration: How to Create and Run a Web Test

Page 5: Are Your Teams Writing Quality Code

55

What Are Web Tests?

Web tests are used to test the functionality of Web applications.

Web tests consist of a series of HTTP requests.Requests are replayed by an agent, and not a Web browser.

The Web application being tested can be any HTTP application, and not just an ASP.NET application. It can also be based on the new AJAX support.

Web tests can be run in parallel to create load tests:

A load test simulates multiple users opening simultaneous connections to a server and making multiple HTTP requests.

Page 6: Are Your Teams Writing Quality Code

66

What Is the Importance of Web Tests?

Web applications are becoming increasingly complex.

Many Web applications host business critical functions.

Web applications must have both high performance and be broadly scalable.

Consumers are expecting ever more compelling and stable Web sites.

A single problem can lose the loyalty of millions of users.

Page 7: Are Your Teams Writing Quality Code

77

How Web Tests Are Created

Recorded Web tests are:Created by simply recording a browsing session.

Stored as XML.

Edited graphically in the Web Test Editor.

Coded Web tests are:Generally created by converting a recorded Web test.

Stored as .NET Code (VB.NET or C#.)

Edited in a code editor.

Can easily access the full power of the .NET Framework.

Necessary for branching and looping.

Page 8: Are Your Teams Writing Quality Code

88

How Web Tests Are Run

Web Tests can be triggered in the following ways:• Web Test Editor• Test View Window• Test Manager Window• Command Line• Using the Web Test Viewer: Web Test Viewer shows an overview of the status of individual requests. View the details of each request in the Web test and the resulting

response to those requests.

Page 9: Are Your Teams Writing Quality Code

99

What Are Validation and Extraction Rules?

Validation rules help verify if the Web application is functioning properly. They verify the:

Existence of text, tags, or attributes on the page returned by a Web request

Time it takes a request to finish

Existence of form fields and their values

Extraction rules:Extract data from the responses to Web requests

Store results in the test context as name value pairs

Can extract form fields, text, attributes, headers, regular expressions, and hidden fields.

Page 10: Are Your Teams Writing Quality Code

1010

Demonstration: How to Create and Run a Web TestAt the end of this demonstration, you will see how

to:

Record a Web test.

Edit a recorded Web test.

Run a recorded Web test.

View the results of a test run.

Convert a recorded Web test into a coded Web test.

Page 11: Are Your Teams Writing Quality Code

1111

Demonstration: How to Verify Web Tests

In this demonstration, you will see how to verify a Web test using the Web Test Viewer.

Page 12: Are Your Teams Writing Quality Code

1212

Overview of Load Tests

What Are the Functions of a Load Test?

Types of Load Tests

Considerations for Choosing Load Profiles

Considerations for Choosing Connection Models

Demonstration: How to Create a Load Test Using Load Test Wizard

How Load Tests Are Run

Demonstration: How to Run a Load Test

Page 13: Are Your Teams Writing Quality Code

1313

What Are the Functions of a Load Test?

The primary goal of a load test is to simulate many users accessing a server at the same time.

Adding Web tests to a load test simulates simultaneous connections to a server, and making multiple HTTP requests.

Adding unit tests to a load test is equivalent to testing the performance of non-Web based server components, for example, an application of a unit test under load is to test data access model components.

Page 14: Are Your Teams Writing Quality Code

1414

Types of Load TestsType of Test Description

Smoke Tests how your application performs under light loads for short durations

Stress Determines if the application will run successfully for a sustained duration under heavy load

Performance Determines how responsive your application is

Capacity Planning Determines how your application performs at various capacities

Page 15: Are Your Teams Writing Quality Code

1515

Considerations for Choosing Load Profiles

A load pattern defines the number and increase rate of virtual users active during a load test. The types of load patterns are:

Constant

Step

Goal-based

Page 16: Are Your Teams Writing Quality Code

1616

Considerations for Choosing Connection Models

Connection Model Features Considerations

Connection Per User

• Most closely simulates the behavior of a real browser

• Uses one or two connections per virtual user

• Same connections are re-used for subsequent requests

Number of connections held open on the agent computer may be as high as twice the user load

Connection Pool

• Connections to the Web server are shared among virtual Web test users

• Tests that are running on by different virtual users could share a connection

One Web test may have to wait before issuing a request

Page 17: Are Your Teams Writing Quality Code

1717

Demonstration: How to Create a Load Test Using Load Test WizardAt the end of this demonstration, you will see how to create a load test using the Load Test Wizard.

Page 18: Are Your Teams Writing Quality Code

1818

How Load Tests Are Run

Load Tests can be triggered in many different waysWeb Test Editor

Test View Window

Test Manager Window

Command Line

Using the Load Test ViewerWeb Test Viewer shows an overview of the status of individual requests

View the details of each request in the Web test and the resulting response to those requests.

Page 19: Are Your Teams Writing Quality Code

1919

Demonstration: How to Run a Load Test

At the end of this demonstration, you will see how to

Run a Load Test

View the Load Test results

Page 20: Are Your Teams Writing Quality Code

2020

Overview of Interpreting Test Results

How Load Test Analyzer Is Used

What Is the Load Test Repository?

What Is a Test Rig?

Demonstration: How to Access Load Test Results Using Load Test Analyzer

Page 21: Are Your Teams Writing Quality Code

2121

How Load Test Analyzer Is Used

Use the Load Test Analyzer to view Load Test data from a completed test run.

Analyze the test run to locate bottlenecks, identify errors, and measure improvements.

Load test data contains:Performance counter samples from the computers under test, plus any other configured performance counters.

Error and threshold rule violation information.

The test controller saves some performance counter data for a test run; the amount saved, and it’s location, is configurable

Page 22: Are Your Teams Writing Quality Code

2222

What Is the Load Test Repository?

Information gathered from load tests is stored in the Load Test Results Store.

The Load Test Results Store contains performance counter data and information about recorded errors.

Load test run data from previous test runs can be retrieved using Load Test Analyzer.

Page 23: Are Your Teams Writing Quality Code

2323

What Is a Test Rig?

A test rig is made up of a test controller and one or more agents. A test rig:

Provides distributed, automated test execution.

Can simulate hundreds of thousands of users.

Can generate far more load than a single machine.

Page 24: Are Your Teams Writing Quality Code

2424

Demonstration: How to Access Load Test Results Using Load Test Analyzer At the end of this demonstration, you will see how to access load test results using Load Test Analyzer.

Page 25: Are Your Teams Writing Quality Code

2525

Page 26: Are Your Teams Writing Quality Code

2626

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.