Integration testing frameworks for testing a distributed system?

前端 未结 4 853
野趣味
野趣味 2021-02-04 08:41

I have a distributed system with components spread across multiple boxes. They talk to each other using tcp or multicast. Each components interchanges messages with each other -

4条回答
  •  心在旅途
    2021-02-04 09:26

    I suppose there are different ways of doing it. I try to avoid integration testing as much as I can but at some point is needed ofcourse. This is just a suggestion what I would do:

    1. Using a behavior driven approach define clearly the scenarios you want to test.
    2. Do unit testing(No integration), to the procedures that will represent the outputs of a module.
    3. Unit test the procedures that are supposed to use inputs from other modules, but by using mocks. Testing the logic of another module in the current.
    4. Perform smoke tests, this type of test will ensure that your modules can communicate between each other(This is a type of integration testing). I think smoke test is just enough integration testing. If you think about it: why would on module care about what other module does?(Lets leave each part do whatever they want, but only care about what how to communicate with them)

    Personally I think that calling objects from one distributed module into another in test methods, is not a good practice. Yes that would be an integration test, but I think it is very easy reliable.

    Always have in mind the pyramid of testing, remember that integration tests and end to end tests can be very expensive. So choose wisely when to use them:

    enter image description here

    I come from the Java world, this following is just some extra information that I think is also related to the topic and might be of your interest:

    • The Data Transfer Object pattern, is interesting
    • RMI vs EJB vs HTTP(Some interesting comment on differences between remote invocation technologies)
    • Spock a BDD framework for java developers.(If you perfectly understand the business rules then testing is a way easier)

    Hope you find it useful.

提交回复
热议问题