jeudi 3 décembre 2015

Unit testing of communication-classes

I have a class used for handling a connection to an external system. The class has some a few public methods, let's say:

  • close()
  • configure()
  • send()
  • connect()

And a handful of private methods. The class is intended to hide most of the re-establishing, fail-checking and connection-handling in the internal works.

Now, I get a code coverage error on this, since there is no unit tests for this class, besides the configure-method.

  • Is there another way of writing unit tests for such classes, except for heavy mocking?
  • If so, isn't that a good proof the class should be tested at an intergration-test or system-test level rather than unit-test? Do communication-classes belong to unit-tests or system tests?

Aucun commentaire:

Enregistrer un commentaire