I need to get mock data for client calling to spring restful web services. I know unit testing purpose we can use mock. but my case is not the testing.
Asked
Active
Viewed 52 times
0
-
1. if not for testing, why would you need a mock 2. what have you got so far? – Stultuske Sep 18 '17 at 09:55
-
I need to integrate with existing production web service. so before call it i need to response sample data to client side developer for testing purpose. – Duminda Jayarathne Sep 18 '17 at 09:57
-
what's stopping you from returning hardcoded data? – Stultuske Sep 18 '17 at 09:59
-
I can hard code but when i integrate with production , there are hard coded data which is unclear the code. – Duminda Jayarathne Sep 18 '17 at 10:07
1 Answers
0
Use hard coded data, or external data file, or external data source to store mock data. I understand the need to host a service that responds but may not be fully wired, to allow early integration with downstream clients. These are the techniques I use, each have pros and cons.
Hard coded data - as you say, is not intuitive or easy to change. Okay for temporary state.
External data file - able to update dynamically as needed
External data source - able to create multiple scenarios with dynamic mock payloads, and change on demand

Megan D
- 379
- 3
- 13