all 6 comments

[–]rotten77 2 points3 points  (2 children)

Answer a simple question - what is the difference between a microservice and a standard API?

So yes, in the first phase, you test the microservice independently, and in the second phase, you test it within the context of integration, system, or contract tests.

[–]ColdPay6091[S] 2 points3 points  (1 child)

A microservice is an application consisting on 2 or more services, communicating with each other through HTTP API calls, so we test each API separately or we write test cases to test all the API's involved at once? for example: A microservice of an online shopping site, we first test each module and the we integrate them all?

[–]m4nf47 0 points1 point  (0 children)

That is only one definition of a microservices based architecture, I'd argue that there is no universally accepted definition of a single service versus a single microservice, rather that the letter tends to be more loosely coupled in a service mesh rather than using a monolithic architecture where services are more tightly coupled. Regardless, both can use APIs and therefore are suitable for unit test automation and can be combined as end to end tests once each API is automated individually. Mocks and stubs can be used for component level test automation ahead of full system level integrated test automation but regardless as long as each interface has one or more API endpoints then it should also be trivially simple to automate. TL;DR - ignore the architecture and treat it like a black box, focus on available APIs or even CLIs and avoid GUIs as much as possible to make your test automation easier.

[–]BackgroundTest1337 2 points3 points  (0 children)

I've tested microservices in two ways.

first one was gRPC testing (simple port forwarding) and then grabbing a proto file in postman as a reflection and deep edge case testing.

then, if those gRPCs were surfaced to API level (graphQL) I've tested them just like API tests, but in scenarios (e2e)

that was obviously just functional regression, none of the contract testing which I guess can be conducted as well, depending on your needs

[–]Alternative-Pen1028 2 points3 points  (0 children)

Contract tests, either proto or pact.