Testing Java Sockets

后端 未结 4 1185
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 07:11

I\'m developing a network application and I want to get unit testing right. THIS time we\'ll do it, you know? :)

I\'m have trouble testing network connections, thou

4条回答
  •  北海茫月
    2020-12-13 07:22

    It's difficult testing connection and server interactions.

    Tipically, I isolate business logic from communication logic.

    I create scenarios for unit tests on business logic, these tests are automatic (use JUni,t and Maven) and i create other scenarios to test real connections, I don't use framework like JUnit for these tests.

    In last year I've used Spring Mocks to test logic with HttpResponse HttpRequest, but I think this is not useful.

    I follow this question.

    Bye

提交回复
热议问题