如何在VSTS 2010中自定義真實網(wǎng)絡仿真
mso-hansi-font-family: Verdana" lang=ZH-CN>中網(wǎng)絡仿真(Network Emulation)新特性
與VS20008 相比,VS2010中提供的網(wǎng)絡仿真(Network Emulation)可以模擬那些使用可靠的物理鏈路的有線和無線網(wǎng)絡,如以太網(wǎng)。并且VS2010里提供的網(wǎng)絡仿真模型中加入了許多新的網(wǎng)絡屬性:如跨網(wǎng)絡的往返時間(延遲)Latency、 可用帶寬、 排隊方式、 數(shù)據(jù)包丟失量、 數(shù)據(jù)包的重新排列和錯誤傳播等,并為篩選基于 IP 地址或TCP、 UDP 和 ICMP協(xié)議的網(wǎng)絡數(shù)據(jù)包提供了靈活性。因此與VS2008相比,VS2010網(wǎng)絡仿真為用戶模擬出更真實的網(wǎng)絡環(huán)境。
VSTS 2010中提供下列10 種網(wǎng)絡類型:
◆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)絡仿真配置文件(Network Emulation Profile)
VS2010中自有的網(wǎng)絡仿真配置文件位于:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Templates\LoadTest\Networks
例如:VSTS 201 中新提供的3G網(wǎng)絡定義如下:
- <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">?。瘜拵滦兴俣榷x
- <Bandwidth>
- <Speed unit="kbps">512</Speed>
- <QueueManagement> //數(shù)據(jù)包排隊方式定義
- <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">?。瘜拵闲兴俣榷x
- <Bandwidth>
- <Speed unit="kbps">64</Speed>
- <QueueManagement> ?。瘮?shù)據(jù)包排隊方式定義
- <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)絡屬性如網(wǎng)絡延遲(Latency)、寬帶上行/下行速度、 數(shù)據(jù)包排隊方式、 數(shù)據(jù)包丟失設置相應的值
3.將自定義的network文件放置在: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Templates\LoadTest\Networks
當我們運行Unit/Load Test 時,就可以利用自定義的網(wǎng)絡類型進行網(wǎng)絡模擬:
◆Configuration Settings – localtestsettings 頁中的網(wǎng)絡模擬列出了我們自定義創(chuàng)建的網(wǎng)絡類型:
◆在Load Test Wizard的網(wǎng)絡組合里列出了我們自定義創(chuàng)建的網(wǎng)絡類型:
以后的博客中將分享更多的網(wǎng)絡模擬高級特性,包括對網(wǎng)絡數(shù)據(jù)包的排隊方式、 數(shù)據(jù)包丟失量、 數(shù)據(jù)包的重新排列和錯誤傳播等,以及篩選基于 IP 地址或TCP、 UDP 和 ICMP協(xié)議的網(wǎng)絡數(shù)據(jù)包進行模擬。
【編輯推薦】