hoverfly-java
hoverfly-java copied to clipboard
Simulation fails for google OAuth2
Uploaded the captured activity, but fails to simulate
08:40:59.095 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=accounts.youtube.com error=No match found method=GET path=/accounts/CheckConnection query={pmpo=[https://accounts.google.com], timestamp=[1534747258848], v=[285632338]}
08:40:59.096 [Thread-2] INFO hoverfly - Going to call real server
08:40:59.144 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=play.google.com error=No match found method=POST path=/log query={format=[json], hasfast=[true]}
08:40:59.145 [Thread-2] INFO hoverfly - Going to call real server
08:40:59.184 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=play.google.com error=No match found method=POST path=/log query={format=[json], hasfast=[true]}
08:40:59.185 [Thread-2] INFO hoverfly - Going to call real server
08:40:59.820 [Thread-2] INFO hoverfly - Going to return response from real server
08:40:59.998 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:00.423 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:18.102 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=accounts.google.com error=No match found method=POST path=/_/lookup/accountlookup query={_reqid=[31279], hl=[en], rt=[j]}
08:41:18.103 [Thread-2] INFO hoverfly - Going to call real server
08:41:18.857 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:18.949 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=play.google.com error=No match found method=POST path=/log query={format=[json]}
08:41:18.949 [Thread-2] INFO hoverfly - Going to call real server
08:41:18.949 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=play.google.com error=No match found method=POST path=/log query={format=[json], hasfast=[true]}
08:41:18.950 [Thread-2] INFO hoverfly - Going to call real server
08:41:19.150 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:19.218 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:26.317 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=accounts.google.com error=No match found method=POST path=/_/signin/challenge query={TL=[AHnYQLzqek0kHkmH3ZrMBZpY0H0DIse84YCusl9w5pv0l4KX7EM19edCrc7w4MqcCzEVJ1qmVJF7ggHbEH2Q9euifPLvZ1MM3zKFeaPDM_Aso7LimN9kKDCWpLDfeSZzMWwCPgCYFPoMjE-WW1h58iMjVy-o7-4gKb4GxqcYoS_szOgi-4dFAdA], _reqid=[131279], hl=[en], rt=[j], tl=[AHnYQLzqek0kHkmH3ZrMBZpY0H0DIse84YCusl9w5pv0l4KX7EM19edCrc7w4MqcCzEVJ1qmVJF7ggHbEH2Q9euifPLvZ1MM3zKFeaPDM_Aso7LimN9kKDCWpLDfeSZzMWwCPgCYFPoMjE-WW1h58iMjVy-o7-4gKb4GxqcYoS_szOgi-4dFAdA]}
08:41:26.317 [Thread-2] INFO hoverfly - Going to call real server
08:41:27.048 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:27.130 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=accounts.google.com error=No match found method=POST path=/ListAccounts query={gpsia=[1], json=[standard], source=[ChromiumBrowserINSERTED,counter:1,load_time_ms:33601]}
08:41:27.131 [Thread-2] INFO hoverfly - Going to call real server
08:41:27.248 [Thread-2] INFO hoverfly - Going to return response from real server
08:41:27.286 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=accounts.google.com error=No match found method=GET path=/CheckCookie query={checkConnection=[youtube:1034:1], checkconnection=[youtube:1034:1], checkedDomains=[youtube], checkeddomains=[youtube], chtml=[LoginDoneHtml], continue=[https://accounts.google.com/signin/oauth/consent?authuser=unknown&part=AJi8hANiKgpRPmnr8NJzdK8iyOKaka7G4GB75NuSINtcgc1uJypO-JIl_zMw3IpT3BKpoAjZJVe3n3rP2CrfcVlhnhgMIWOx_3dORjiniQBnmf3tqnLq6Sfcp-5e8V731AH9yI-AaWvmX-GrJJuZ32pmsLpivrQUZZO4CazkdqUamyCjyRwsPpSEe_r9wzz_8kyr-L_4mp769SX8vPRsb2klSNfkTn9LJysvYjmXlz_QCf8OxoCSJU1E7_iRHQ4Nw_orjsbJ-2VLojSs-_5zbFK3W-ndmgveRnkfv4zeo0FV73YZrkudM80TAlkH8irZBKcxV8d3_hZHy-3nOT0mmKhUwZ3-LH5m-hkR4Hb_jnVOc76RbkJRjhrvhgf8MeupIOagOCWYvta2WLpBtwPJDWiBmjeLw3sNKwz6_uOr_8gO7ZOPEOtNK6Y&as=PVVOLASk_TQWWgqK8-xlQA#], gidl=[EgIIAA], hl=[en], service=[lso]}
08:41:27.298 [Thread-2] WARN hoverfly - Failed to find matching request from simulation destination=accounts.google.com error=No match found method=POST path=/_/common/diagnostics/ query={_reqid=[231279], hl=[en], rt=[j]}
08:41:27.300 [Thread-2] INFO hoverfly - Going to call real server
08:41:27.308 [PoolService-0] INFO io.specto.hoverfly.junit.core.Hoverfly - Destroying hoverfly process
- Hoverfly appears to be operating correctly given the log output - all the diagnostic messages indicate your requests are not matching the simulation which suggests you need to first modify the simulation
- Hoverfly appears to be be in spy mode - it does not simulate mode if that is what you are expecting
- We recommend you start with simpler simulations than this and focus on why an individual request is not-matching - a 4MB simulation file is far too big to work with
@JohnFDavenport Thank you very much :)
@Amr1977 In additional to what @JohnFDavenport has suggested, I remembered that I have bumped into the same problem in the past for a test that uses Google OAuth. I've now recalled what the issue was.
When you captured the workflow, hoverfly only saves multiple identical requests once, which breaks your test when you try to simulate. There was a release https://github.com/SpectoLabs/hoverfly/releases/tag/v0.17.0 that provides stateful capture, and would capture all the request-response pairs as they were played out. You can find the docs here: https://hoverfly-java.readthedocs.io/en/latest/pages/corefunctionality/capturing.html#capturing
Speaking of which I need to try it out myself as well.
Thank you @tommysitu, upon diagnosing simulation JSON I found that google encodes all requests and responses starting from user providing email and password and redirection to callback URI (I might be mistaken) so I think I have to directly call our callback URI with proper parameters pretending that a google user is authenticated, bypassing email/password entry steps, I think that would be interesting feature if integrated in hoverfly for google OAuth2 because it is not trivial to decode google authentication transactions.