0

I have recently been reading about the test pyramid and how integration testing fits into the grand scheme of things, when it comes to web services, with regards to API testing.

QUESTION: Does API testing only include websites that have a public API? Or is it possible to do integration testing on a website without one?

0

The term integration testing is a bit confusing as it is not always clear what the scope of the test is. I guess this article from Martin Fowler make a good distinction between narrow and broad integration tests:

https://martinfowler.com/bliki/IntegrationTest.html

With the narrow integration tests you could for instance test the interaction of code in several classes together. You can use the same test framework as that you use for the unit tests. The tests are written usually by the developers, you will at least need to have access to the source code. There is no requirement at all for having a public API for the application.

If you would have a broader integration test, (or in this case a very broad test) you could think of using tools like SOAP UI to test the Web Service of a full running application. This Web Service might be public or access is restricted to only interact with specific systems. If it has restricted access, then the environment must be configured to provide access for the SOAP UI tests.

Having publicly accessible API is thus not a technical requirement for being able to test at any level in the application. What probably matters more is what the relation between the tester and the development team is. If you need to test software developed by a third party, it is unlikely that you will be participating in creation of narrow integration tests. If you are working together with developers in one team then there is nothing that holds you back from doing so (other than your own coding skills).

  • Interesting. I think I will need to go back and read about SOAP and Rest testing as I was under the impression that you needed a public API in order to use them properly. – Jonnyboy May 18 '18 at 7:36
  • You need an API and access to it, but the rest of the world doesn't need to have access and it thus doesn't have to be public. It is quite common that a server X has an API specific for communication with one other server Y, thus access to the API is only granted to Y and not the rest of the world. If you want to test this API, then the test environment must be configured to provide your testing tools access as well. – Pieter A May 18 '18 at 8:21
1

If you are talking about this explanation from Martin Fowler, if you don't have public API - you do not have a Service layer. So you can't perform testing at that layer.

That said, at some point the browser sends a HTTP request to the server and gets a response. If you have access to the source, you might be able to create a layer above the HTTP commands and should be able to perform the tests.

  • It is perfectly possible to create an application with a public web service with only a controller class and no service layer. Also, not having a public API does not limit a programmer to run test on the service layer using the same framework that is used for unit testing. – Pieter A May 17 '18 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.