Capture network usage for a QTP test
Question ID: 104861
1
0

We are using QTP to capture some performance information. We can easily capture wall clock time.

does anyone have some code to capture the network bytes transmitted and received for a test case? specifically we are doing tests against a Java Server Faces UI running on windows 7/IE 8.

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 20, 2013 8:46 pm
123 views
Answers (1)
3
Private answer

After doing some additional research, I have uncovered a better set of code that will return the network speed. I have seen in some discussions that people are reporting that not all network cards will report their speed through the WMI object.

Also, modify the print line to handle the data differently. It is included so that the physical output can be displayed easily.

sPC = ''.''
iConnected = 2
iEthernet = 0
iWireless = 9
Set oWMIService = GetObject(''winmgmts:\'' & sPC & ''rootCIMV2'')
Set colItems = oWMIService.ExecQuery(''SELECT * FROM Win32_NetworkAdapter'', , 48)

For Each oItem In colItems
If (oItem.AdapterTypeId = iEthernet _
Or oItem.AdapterTypeId = iWireless) _
And oItem.NetConnectionStatus = iConnected Then
If IsNull(oItem.Speed) _
Then sSpeed = ''Speed not reported'' _
Else sSpeed = Left(oItem.Speed, Len(oItem.Speed) - 6) & '' MBits/s''
print oItem.Name & '': '' & sSpeed
End If
Next

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on February 25, 2013 3:42 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top