Is there any way in which I can generate access token to test oauth for logging in with gmail?
I have created a google app, and got the client and secret ids.
Don't forget that you should be able to mock google OAuth. In other words, in most test situations (except for monitoring and certain types of load testing), it should be possible to simulate a successful connection to Google OAuth and the corresponding callback. In order to do that you may just have to use methods already present in the testing tool you are using.
Even if this answer does not directly answer the subject, I think it was necessary to write it here to allow some people to consider this workaround, adapted to the majority of automated test situations.