When writing a program, should I write tests that ensure that the dependencies I use are working? Those might help to check my assumptions about them, and may also help when deciding to upgrade said deependencies.Also, are there any established opinions or schools about whether or how one should go about that?
Unit testing external dependencies
unit testing;dependencies
Yes, you should definitely write tests to verify that your external dependencies are working. However, these aren't unit tests but integration tests.Unit testing exercises small parts of your code in isolation - that is, isolated from external dependencies, using e.g. mocks. This way you can verify that each small part in itself works as expected. After that, you still need to verify that the whole app, in its fully assembled form, works properly. However, in those tests you exercise the whole system on the highest level, via its user interface (command line / GUI / web / whatever). So integration tests are very different from unit tests, in several ways: usually theytake much longerare harder to automateneedn't be as detailedIn the technical sense, integration tests overlap with system / validation / acceptance / functional tests, whereas each exercises the functionality of the whole system. However, the purpose of integration tests is simply to verify that the system in its assembled form works correctly in general, so it doesn't test each and every piece of functionality down to the nittiest details. However, one can use the same tool(s) for each of these kinds of tests. These tools can be very different, depending on the UI and platform of the system. Wikipedia's Test automation page lists references to some well known tools.