问题
I have test cases, which make requests to real, not mocked, third-party services and verify that functions that handle responses are doing it correctly.
I can't call them "functional", because they test only small pieces of code, that responsible to communication with third-party services. And I can't call them "unit" - because they hit real external services.
What is correct name for them?
回答1:
Those are called integration tests.
Basically you have three types of tests:
- Unit tests, no external dependencies everything is mocked
- Integration tests, look like unit tests but with external dependencies
- Acceptance/Scenario tests, those test your actual application through the browser or client software. These can be automated or performed manually.
回答2:
As far as I can tell, there's no strict, well-defined terminology, because there are so many combinations of test configurations that it's impossible to label them all consistently.
- As Wouter de Kort points out, some people call these tests Integration Tests, although I agree with the comment that I personally would reserve that term for integration of multiple modules in the same process, but still using fake external dependencies.
- If you're truly testing the entire stack, you could call them System Tests.
- If you're testing everything except the UI, you could call them Subcutaneous Tests.
- If you only do a few of these full-stack tests to see if everything works well together, you could call them Smoke Tests.
- If you're mainly concerned that the external services behave in a way your system can understand, your tests may be Integration Contract Tests.
- If the purpose of these tests is to verify whether or not you can go live, they would be called Acceptance Tests.
There are many more labels, depending on your particular motivations and exactly how you do it. Making naming even more difficult is that some of these terms can be combined; e.g., a test can be both a System Test and an Acceptance Test at the same time, and then what do you call it?
回答3:
I will put them under the category of integration tests and regression . Integration tests not only test integration within components but also between third party services. You should also have a few of them under regression tests because you always need to regress the contract defined by your third party services.
Also, these need to be tested before your acceptance or scenario tests to ensure that your basic functionalities still work.
If it is a third party package (like a jar), you should include it within your unit test
来源:https://stackoverflow.com/questions/22653141/what-to-call-test-cases-that-are-test-integration-with-third-party-services