Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
10 years ago

Can TestComplete sniff ethernet / USB traffic?

Our software product is used to configure our hardware which is connected via ethernet or USB. When I configure a product feature I need to be able to test that the correct packets have gone down to the panel. Currently I have to do this using Wireshark and manually search and interpret packets.



Is there a way that TestComplete can monitor USB or IP traffic directly (without the need for Wireshark) so that I can write scripts that verify that the correct packets are being sent?

6 Replies

  • maximojo's avatar
    maximojo
    Frequent Contributor
    I had to do something similar but for web traffic using Fiddler. I actually had TestComplete start Fiddler in recording mode before my tests started, then when the tests were finished I had Fiddler export the logs as text.



    Then I could load up the text file in TestComplete and parse as required to verify certain parts of the test.



    One possible option for you if TestComplete doesn't allow this natively. I'm sure you can export the traffic from Wireshark in some format.
  • MulgraveTester's avatar
    MulgraveTester
    Frequent Contributor
    Thanks Mark. I did that years ago. I exported the log file from Wireshark, import it into Excel and ran a script to interpret each packet. It was a lot of work - then Wireshark changed the way that it exported data and our protocol was modified so the VBA script went in the junk pile.



    I'm looking for a method that will let me check packets on the fly so that I can compare tests to traffic.
  • g_kucharski's avatar
    g_kucharski
    Occasional Contributor
    Simplest what I found was using netstat -e shell command and processing its output.



    It will not give you information on specific proccess however, just on general traffic.



    Function below works for English WIN 8.1


    Function NetStat_win8



      Dim strLine

      Dim varMBIn, varMBOut

      strLine = getCommandOutput("netstat -e")

      strLine = Left(strLine,InStr(strLine,"Unicast") - 1)

      strLine = Ltrim(Right(strLine,Len(strLine) - InStrRev(strLine,"Bytes") - 4))

      varKbIn = Left(strLine,InStr(strLine," "))/1024

      varKbOut = Ltrim(Right(strLine,Len(strLine) - InStr(strLine," ")))/1024

      log.Message varkbIn &"/" & varkbOut

      NetStat_win8 = Array(varkbIn,varkbOut)



    End Function



     



     



     


  • MulgraveTester's avatar
    MulgraveTester
    Frequent Contributor
    Thanks for your replies.



    Helen: Our protocol is an in-house beast that has evolved over 10-15 years, so I won't be able to find any pre-written libraries. The links that you posted look promising and I will try to convert them to VBScript that I am using. Thanks.



    Grzegorz: The netstat command only gives basic statistics. I need to capture actual packets and check that they are formatted correctly. But thanks for posting.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Michael,



    > Our protocol is an in-house beast [...]



    If this is the case, any option to talk to developers and ask them for some supplementary functionality that will make it possible to you to query the information that you need from TestComplete? (E.g. some DebugString output, separate function call, debug output to file if some parameter is specified, etc.)