Answer the question
In order to leave comments, you need to log in
How to test methods that use third-party data?
I study testing, logical questions begin to arise, to which I cannot find answers on the Internet. How to test methods that use not only the data that is passed to them in the parameters? For example, in a web application, the method takes the object ID as a parameter from the url, inside it checks whether the user is logged in, whether this user is an admin, then checks how many more objects in the database have names like the object ID. Well, it returns HTML text.
How to test this?
Thank you.
Answer the question
In order to leave comments, you need to log in
To test such methods, you will have to create a test environment and labor-intensive test cases to implement. It is easier to break such methods into a set of loosely coupled ones (separate methods for each of the actions you listed, it is desirable to link them together with simple, easily repeatable data types in test cases) and test them separately first. Code coverage with tests will be better because for simple methods it is easier to provide for edge cases, testing the final bunch of methods is reduced to one or two control cases of passing simple data types between methods.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question