如何在VSTS 2010中自定義真實(shí)網(wǎng)絡(luò)仿真
mso-hansi-font-family: Verdana" lang=ZH-CN>中網(wǎng)絡(luò)仿真(Network Emulation)新特性
與VS20008 相比,VS2010中提供的網(wǎng)絡(luò)仿真(Network Emulation)可以模擬那些使用可靠的物理鏈路的有線和無(wú)線網(wǎng)絡(luò),如以太網(wǎng)。并且VS2010里提供的網(wǎng)絡(luò)仿真模型中加入了許多新的網(wǎng)絡(luò)屬性:如跨網(wǎng)絡(luò)的往返時(shí)間(延遲)Latency、 可用帶寬、 排隊(duì)方式、 數(shù)據(jù)包丟失量、 數(shù)據(jù)包的重新排列和錯(cuò)誤傳播等,并為篩選基于 IP 地址或TCP、 UDP 和 ICMP協(xié)議的網(wǎng)絡(luò)數(shù)據(jù)包提供了靈活性。因此與VS2008相比,VS2010網(wǎng)絡(luò)仿真為用戶模擬出更真實(shí)的網(wǎng)絡(luò)環(huán)境。
VSTS 2010中提供下列10 種網(wǎng)絡(luò)類型:
◆Cable-DSL 384Kps
◆Test simulating LAN
◆Cable-DSL 1.5Mbps
◆Cable-DSL 768Kbps
◆ 3G
◆CDMA
◆Dial-up 56k Modem
◆ Intercontinental slow WAN 300 Kbps
◆Intercontinental slow WAN 1.5 Mbps
◆Intra-continental slow WAN 1.5 Mbps
自定義 mso-hansi-font-family: Verdana" lang=ZH-CN>中網(wǎng)絡(luò)仿真配置文件(Network Emulation Profile)
VS2010中自有的網(wǎng)絡(luò)仿真配置文件位于:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Templates\LoadTest\Networks
例如:VSTS 201 中新提供的3G網(wǎng)絡(luò)定義如下:
- <NetworkEmulationProfile name="3G" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
- <Emulation>
- <VirtualChannel name="ThreeG-Channel1">
- <FilterList />
- <VirtualLink instances="1" name="link1">
- <LinkRule dir="upstream"> //寬帶下行速度定義
- <Bandwidth>
- <Speed unit="kbps">512</Speed>
- <QueueManagement> //數(shù)據(jù)包排隊(duì)方式定義
- <NormalQueue>
- <Size>100</Size>
- <QueueMode>packet</QueueMode>
- <DropType>DropTail</DropType>
- </NormalQueue>
- </QueueManagement>
- </Bandwidth>
- <Latency> //延遲定義
- <Fixed>
- <Time unit="msec">150</Time>
- </Fixed>
- </Latency>
- <Loss> //數(shù)據(jù)包丟失定義
- <Random>
- <Rate>0.0025</Rate>
- </Random>
- </Loss>
- </LinkRule>
- <LinkRule dir="downstream"> //寬帶上行速度定義
- <Bandwidth>
- <Speed unit="kbps">64</Speed>
- <QueueManagement> //數(shù)據(jù)包排隊(duì)方式定義
- <NormalQueue>
- <Size>100</Size>
- <QueueMode>packet</QueueMode>
- <DropType>DropTail</DropType>
- </NormalQueue>
- </QueueManagement>
- </Bandwidth>
- <Latency> //延遲定義
- <Fixed>
- <Time unit="msec">150</Time>
- </Fixed>
- </Latency>
- <Loss> //數(shù)據(jù)包丟失定義
- <Random>
- <Rate>0.0025</Rate>
- </Random>
- </Loss>
- </LinkRule>
- </VirtualLink>
- </VirtualChannel>
- </Emulation>
- </NetworkEmulationProfile>
1. 為網(wǎng)絡(luò)屬性如網(wǎng)絡(luò)延遲(Latency)、寬帶上行/下行速度、 數(shù)據(jù)包排隊(duì)方式、 數(shù)據(jù)包丟失設(shè)置相應(yīng)的值
3.將自定義的network文件放置在: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Templates\LoadTest\Networks
當(dāng)我們運(yùn)行Unit/Load Test 時(shí),就可以利用自定義的網(wǎng)絡(luò)類型進(jìn)行網(wǎng)絡(luò)模擬:
◆Configuration Settings – localtestsettings 頁(yè)中的網(wǎng)絡(luò)模擬列出了我們自定義創(chuàng)建的網(wǎng)絡(luò)類型:
◆在Load Test Wizard的網(wǎng)絡(luò)組合里列出了我們自定義創(chuàng)建的網(wǎng)絡(luò)類型:
以后的博客中將分享更多的網(wǎng)絡(luò)模擬高級(jí)特性,包括對(duì)網(wǎng)絡(luò)數(shù)據(jù)包的排隊(duì)方式、 數(shù)據(jù)包丟失量、 數(shù)據(jù)包的重新排列和錯(cuò)誤傳播等,以及篩選基于 IP 地址或TCP、 UDP 和 ICMP協(xié)議的網(wǎng)絡(luò)數(shù)據(jù)包進(jìn)行模擬。
【編輯推薦】




















