microsoft / dev-proxy

Dev Proxy is an API simulator that helps you effortlessly test your app beyond the happy path.
https://aka.ms/devproxy
MIT License
465 stars 55 forks source link

Generate fake mock data #309

Open Tanddant opened 1 year ago

Tanddant commented 1 year ago

A neat feature would be to use the mock feature with a tool like fakerjs and essentially be able to mock a full API, and generate random data.

For instance when building a user management tool it would be nice to be able to generate 100's of random users mocking the graph endpoints to test things like pagination without having to create those users in my dev tenant

waldekmastykarz commented 1 year ago

That's a great idea! Recently, we released a set of mocks for all Graph endpoints based on Graph API reference docs, but I can imagine that you might need some other/more content.

Did you give some thought how you'd see it work? Would you like the Proxy to generate the mocks on the fly (making the outcomes dynamic but less predictable) or would you rather have something like a subcommand that you can use to generate a specific set of mocks, like m365proxy mock user --numItems 100 and the command would generate hundred mocked users in a mock file that you can plug into the Proxy?

Tanddant commented 1 year ago

That's a good question - my use case was actually just needing random data, I don't necessarily have an opinion on the "best way" - I guess the main thing is just mapping the Graph responses to a "mock" dataset