pynetcheck icon indicating copy to clipboard operation
pynetcheck copied to clipboard

Unit Test wishlist

Open JosephRedfern opened this issue 6 years ago • 4 comments

Having some unit tests will help prevent mistakes like mine reported here: https://github.com/luketimothyjones/pynetcheck/pull/2#issuecomment-428803205

It would be good if we had some test data with which to test parsing regexes. We should try and get as much of a spread as possible, across different OS's and ping versions (although I suppose it's unlikely that the output will change much, it'd be good to test).

As a minimum, it would be good to have examples for:

  • successful ping (0% packet loss)
  • some packet loss (~50%)
  • total packet loss (no response)
  • non-existent domain
  • no route to host.

across multiple OS types and ping versions.

JosephRedfern avatar Oct 11 '18 06:10 JosephRedfern

Added basic ping tests and examples for Win10 and Ubuntu in #9. A good addition would be to add formatting placeholders in the ping examples, such as (example from Ubuntu):

time={ping1_time} ms

That way we can implement the more complex testing you suggest.

samipfjo avatar Oct 15 '18 18:10 samipfjo

@JosephRedfern I added your name and GitHub handle to the contributors section at the top of netcheck.py. Let me know if you have a problem with that; I'll remove them if so.

samipfjo avatar Oct 15 '18 23:10 samipfjo

@luketimothyjones Great, thank you. No problems with that (nor was it expected of you).

JosephRedfern avatar Oct 16 '18 18:10 JosephRedfern

@JosephRedfern Open source is about "us", not "me" :)

samipfjo avatar Oct 16 '18 19:10 samipfjo