I'm aware of the test automation pyramid, unit/integration/gui based automated testing. My question is, what does an integration test look like? I was always under the assumption for the likes of a login scenario we would use GUI automation to handle it, however after more reading I'm not so sure?
Option A
- Prep WebDriver & navigate to login
- Login as the user
- Assert that the user has logged in
Option B
- HTTP GET /Login
- HTTP POST Credentials
- HTTP GET /Index
- Assert that the user is logged in, perhaps their name is in the response body HTML?
Should we be always opting for Option B here? using something like REST-ASSURED and not using Selenium at all in this instance?
How do you decide which to do via the GUI and which via the Service/API layer like this? Obviously to me the API layer seems much more robust, changes to elements on the page will not break the tests etc but on the flip side, how will you know if the login button itself is properly functioning?