When automating user scenarios, we typically cover an end-to-end user flow. Unit testing recommends that each test method should be independant and only test one thing. But things are different in system acceptance testing, as we have to cover a user flow through the application. Consider an ecommerce application where the user visits typically follows the below steps: 1 - visit homepage 2 - search for a product 3 - select the product 4 - add the product to cart 5 - click checkout 6 - sign in 7 - entery peyment details 8 - submit order 9 - wati for confirmation Now each of these steps need to be verified as we flow through the user journey. So, there is dependency in test methods, e.g. step 3 depends on step 2 which breaks unit testing practice. Also if we put all steps in one test method it is not easy to detect what went wrong if the test failed. And if we wanted to isolate each test method so they are independant of each other, we have to repeat the initial steps over and over again.
What I have done in the past is to use TestNG to provide this dependency on previous test methods. But I wanted to know how do you handle user journeys in your testing?