惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - speshow

初涉SQL Server性能问题(4/4):列出最耗资源的会话 初涉SQL Server性能问题(3/4):列出阻塞的会话 初涉SQL Server性能问题(2/4):列出等待资源的会话 初涉SQL Server性能问题(1/4):服务器概况 分享 大型网站的架构设计问题--大型高并发高负载网站的系统架构 Android应用程序运行机制解析 js 小小jquery等比例缩放图片效果 - speshow - 博客园 .net 发送手机短信息 C#实现汉字转换为拼音缩写的代码 .net 导出海量数据到execl文件 - speshow - 博客园 IIs6+Rewrite+asp+php5+mysql5 .net 生成二级域名 各种JAVASCRIPT技巧 使用ASP.NET画饼状图 - speshow - 博客园 我们到底为了什么钻研技术? 生成图片水印 aspnetpager 分页 Jquery 服务器回调为select填值
用VSTS进行网站压力测试
speshow · 2008-12-25 · via 博客园 - speshow

VSTS提供了一个丰富、强大的工具平台,融合了软件开发领域的各个角色,涵盖软件开发生命周期的各个阶段,包括设计,开发,测试管理,而这一整套构件的融会贯通,让它可以有效地改善软件开发过程中各个阶段的弊端,提高团队之间不同的角色的协调能力,提高工作效率。

本文就简单介绍一下如何利用VSTS给一个网站压力测试

1 建立一个测试项目,起名MyTest

2 建立一个Web Test

点击Web Test...
IE马上就会弹出一个窗口,这样录制脚本工作就可以开始了。

3 在IE里输入要测试的网站地址: 比如http://localhost/WebSite/Default.aspx

4 对该网站做一些操作, 此时VSTS会纪录下你的这些操作,用以作为压力测试的场景。

5 录制脚本毕,点击 "STOP"

6 点击生成代码,可以看到刚才录制的类似如下的代码:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MyTest
{
    
using System;
    
using System.Collections.Generic;
    
using System.Text;
    
using Microsoft.VisualStudio.TestTools.WebTesting;
    
using Microsoft.VisualStudio.TestTools.WebTesting.Rules;


    
public class WebTest1Coded : WebTest
    
{

        
public WebTest1Coded()
        
{
            
this.PreAuthenticate = true;
        }


        
public override IEnumerator<WebTestRequest> GetRequestEnumerator()
        
{
            WebTestRequest request1 
= new WebTestRequest("http://localhost/WebSite/Default.aspx");
            request1.ThinkTime 
= 1688;
            ExtractHiddenFields rule1 
= new ExtractHiddenFields();
            rule1.ContextParameterName 
= "1";
            request1.ExtractValues 
+= new EventHandler<ExtractionEventArgs>(rule1.Extract);
            yield 
return request1;

            WebTestRequest request2 
= new WebTestRequest("http://localhost/WebSite/Default.aspx");
            request2.ThinkTime 
= 2;
            request2.Method 
= "POST";
            FormPostHttpBody request2Body 
= new FormPostHttpBody();
            request2Body.FormPostParameters.Add(
"__VIEWSTATE"this.Context["$HIDDEN1.__VIEWSTATE"].ToString());
            request2Body.FormPostParameters.Add(
"Button1""Go to Test Page");
            request2Body.FormPostParameters.Add(
"__VIEWSTATEENCRYPTED"this.Context["$HIDDEN1.__VIEWSTATEENCRYPTED"].ToString());
            request2Body.FormPostParameters.Add(
"__EVENTVALIDATION"this.Context["$HIDDEN1.__EVENTVALIDATION"].ToString());
            request2.Body 
= request2Body;
            ExtractHiddenFields rule2 
= new ExtractHiddenFields();
            rule2.ContextParameterName 
= "1";
            request2.ExtractValues 
+= new EventHandler<ExtractionEventArgs>(rule2.Extract);
            yield 
return request2;

            WebTestRequest request3 
= new WebTestRequest("http://localhost/WebSite/test.aspx");
            request3.Method 
= "POST";
            FormPostHttpBody request3Body 
= new FormPostHttpBody();
            request3Body.FormPostParameters.Add(
"__VIEWSTATE"this.Context["$HIDDEN1.__VIEWSTATE"].ToString());
            request3Body.FormPostParameters.Add(
"Button1""Go to default page.");
            request3Body.FormPostParameters.Add(
"__EVENTVALIDATION"this.Context["$HIDDEN1.__EVENTVALIDATION"].ToString());
            request3.Body 
= request3Body;
            yield 
return request3;
        }

    }

}

7 添加一个Load Test ...

8 填写好Load Test的各项参数
 

1) 第一步是填写场景名
2) 第二步是填写装载的样式
    如果选择一次装载固定的用户数,选择第一项Constant Load
    如果选择"Setp Load",表示步增,设置好开始时的用户数,以及经过多久每次增加的用户数
3) Test Mix
4) Browser Mix
5) Network Mix
6) 在Counter Sets 选择Add Compuer...,表示要对某个PC进行监控
7) Run Settings

9 点击Finish

10 点击Run Test,测试就开始了。

压力测试运行后,我们就可以选中某个参数,查看某个时刻机器个方面的性能。参看下图: 

我们也可以运行perfmon,通过Performance查看机器的各项指标。

8_200706201026121