1

I have a class which wraps various calls to PerformanceMonitor regarding the Network Interface statistics. I have run my tests while manually copying a large file to a shared drive to test calls which calculate the video on demand bandwidth, utilization, etc. Clearly not ideal.

How can I automate this or is there some sort of tool/emulator which hits the network card so that I can run my tests under load so that the correct values are produced?

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
JD.
  • 15,171
  • 21
  • 86
  • 159

1 Answers1

2

That doesn't sound like a unit test to me. Normally things like databases and bits of hardware would be mocked/faked/stubbed in a unit test, and 'fake' results supplied.

I'm afraid its difficult to be more specific with the given information, but in your case I would be looking for a way to provide a fake PerfMon API, which returns hard coded values. There's no value in testing the PerfMon API itself, so create a fake implementation and use that to test whether your code does the right thing in response to those values.

Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • Thanks for the reply. Okay, I have mocked out the performance API but in the actual implementation I am doing some calculations that use several performance counters that make one calculation. In order to see the output I need to flood the network to get some readings. – JD. Oct 03 '12 at 09:05