I am currently working on integration tests in Python involving API calls, read/writes to the file system and objects/classes performing operations on the read files. I have to decide how to approach the tests. I am worried that my integration tests might take some responsibility of unit tests which will result in bad code and if there's a bug it might fail in both integration and unit tests. That, in my opinion, could be avoided by splitting the responsibility between unit and integration tests.
So, integration tests are supposed to check the integration between components and modules, whereas unit tests must check business logic and compliance with what's expected from certain parts of code.
Integration tests are performed without the knowledge of the source code, whereas unit test require the knowledge of the source code.
My question is: even though I test the integration between modules I need to call certain methods and functions and understand if the integration and connection between modules exists. To what extent should I test the functionalities of objects/classes to avoid duplicate responsibility?
For example, my initial idea for endpoints is to check only the OK 200 status to make sure the call was performed. But should the content-type be checked (IMO unit tests should check it)? Should I check how the file uploaded and returned to and from an API was changed and/or modified?
Aucun commentaire:
Enregistrer un commentaire