I am developing the UI of an e-commerce. Actually it is the checkout page only. The entrance URL looks like this: myEcomerce.com/{orderGuid} On load The ui takes the orderGuid as parameter to call the API and get the details. In other words, UI call getOrderDetails passing the orderGuid.
My main concern is in relation with the Testing strategy used to integrate UI and API. For an automation test, I will need a valid orderGuid.
We already had a discussion between UI and API teams. API offers an extra endpoint to create an Order in order to get a valid {orderGuid}
My integration tests in the ui could be...
- call createOrder (only to get a valid order id)
- call getOrder
- populate the view
- asserts..
The UI never will consume this endpoint (createOrder) in production, in fact, this endpoint is consumed by other api client....
UI is forced to work in this extra endpoint (createOrder) if they want to integrate with API. You could imagine this new extra maintenance effort. Deal with the order creation could not be easy.
I believe the API should provide a "Sandbox" environment and a list of valid {orderGuid}s for multiple testing propose. Instead of push this complexity to the consumer.
I do not pretend UI deals with the Order creation only for testing propose. Whatever change in this order creation process is going to affect our hundreds tests making them really fragile. I believe we are not going in the right direction if we need to call the order creation from the UI to retrieve a valid {orderGuid}
Any better idea to deal with the integration tests?