javaintegration-testingrest-assured

Where to put REST Assured tests


Is it a common practice to put REST Assured tests in the same project it will test, or in its own project? Like, I have a microservice called purchase which I will write the tests for. Should the tests be in it, or should I create another project to do it, named some like purchase-integration-tests?

Thanks!


Solution

  • I would like to share the practice which we use in our project:

    Our microservice code is structured into multiple project with one parent. Within the parent project we have below child projects:

    1. Spec- Contains Swagger Spec
    2. Service- Contains Service Code
    3. Integration Tests
    4. Load tests

    As part of the CI/CD pipeline, first the code is build and unit tested, then integration tests which are rest assured based are triggered where all your dependent services are mocked with the help of wiremock, then you have load tests. Build is deployed to the environment after the successful, completion of all the projects.

    Apart from this we also have regression test cases written for specific environments using rest assured as independent project.