0

Using Spring mvc test and mockMvc to test Spring rest controller and its output in form of JSON and its JSON structure and JSON value.

I have two questions :)

  1. We have configured multiple profile in our application like dev, qa and prod and every environment returns different different output. Like for userId 1 will return different output based on profiles. So how can we perform Integration testing on different profiles.
  2. In integration testing I have to also test the structure of JSON as output. It can be different based on input for same end point. How can we proceed in it.

If someone has some idea. Please share. :)

Sagar Rout
  • 651
  • 1
  • 12
  • 29
  • you are using different maven profiles to build your app pointing to different data sources depending on the environment? – germanio Apr 27 '16 at 19:32
  • yes I am using different profile and every profile has different db configuration. – Sagar Rout Apr 28 '16 at 06:53
  • hold on, so you are building your app on every environment? – germanio Apr 28 '16 at 18:22
  • i want to write some code which can run on different environment, so that I can test all my environment by changing the maven profile – Sagar Rout Apr 29 '16 at 06:24
  • ahh ok, so maybe Spring Profiles is what you are looking for. With it, you define the configuration for each profile and then you associate each profile with an environment. Then you build your app once with maven containing all the configurations, and deploy that artifact where you need it. – germanio Jun 06 '16 at 18:19

0 Answers0