I have a scenario where I need to set up integration testing against our microservice architected application. This will mean creating some tests using Postman to hit our API, and running them with Newman. We also use oAuth with Identity Server, so we need to initially authenticate, then receive a token back which is passed into all of the requests.
The problem is when we make the initial call to authenticate the user, how do we know that the user exists in the environment that we are running the tests?
2 possible solutions that I can think of are:
- In the test script, create the User at the beginning (and possibly delete them again at the end). This would be problematic for us because that part of the API is not public (we don't want external users to be able to create new users)
- Deploy a dummy identity service that will return an authenticated token. This doesn't feel like it would be a proper integration test for me.
I was wondering how others would approach this sort of problem?