5

I've a RESTFul microservice written in Grails. This microservice has it's own DB. It also depends on two other microservices.

A typical workflow of the service is:

  1. Receives a GET request from a client e.g. browser
  2. Calls another microservice through http to get some information
  3. Queries it's own DB to get some data
  4. Send a response to the client

I want to write automated tests for this service. Whenever I'll run the test, it'll do the following:

  • Mock the external microservices
  • Create a database and populate it with test data
  • Run the application and configure it to use the mock services and DB
  • Run the test cases by sending http requests and matching responses

My question is: What type of test is this?

I'm not a QA so may be I'm asking a stupid question.

  • I personally enjoy JAX-RS. If you're familiar with JEE, go ahead with this API – user132583 Feb 2 '16 at 6:36
  • Well, I'm actually using JAX-RS with Grails. – Nayan Feb 2 '16 at 6:39
  • Tool/library/framework recommendations are off-topic on this site, so I edited out that part of your question. – Ixrec Feb 2 '16 at 12:07
  • 2
    Could be a Unittest if you consider the microservice to be a single unit including its own database. Could be an integration test if you consider integration of microservice and its database to be worth testing. – SpaceTrucker Feb 2 '16 at 12:13
2

Testing terminology is very messy. Usually I've seen this type of tests to be called "integration tests", but to me it seems to be too overloaded term used also for quite different type of tests.

So I call them component tests. Your microservice is one component of the larger system. Term is quite self-explanatory and fits well definition from Martin Fowler:

A component test is a test that limits the scope of the exercised software to a portion of the system under test. It is in contrast to a BroadStackTest that's intended to exercise as much of the system as is reasonable.

0

I would call it just "unit tests".

And Mock objects are very common in Unit Tests, because those need to be independent from each other ( so test of feature X cannot depend on test of DB connector ).

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.