tag:blogger.com,1999:blog-7821856652257554779.post4178823251791945811..comments2025-09-20T09:27:07.510+02:00Comments on Andrzej on Software: Events in acceptance testsAndrzej Krzywdahttp://www.blogger.com/profile/06399276063142826365noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-7821856652257554779.post-42495216665367200582011-04-27T00:14:42.817+02:002011-04-27T00:14:42.817+02:00@Andrzej You can have many side scenarios attached...@Andrzej You can have many side scenarios attached to one event type. In contrived example after "product:created" you may want to check if a user can recommend a product (but there is no need to check it for every "product:created"). On the other hand you may want to check if product has accurate discount (and you'll probably check this on every "product:created").<br /><br />For me "practicality beats purity" - advantage of restoring application to previous state means less bugs connected to accidental or implicit state modification in side scenarios.<br /><br />The workaround you proposed: moving state-changing side scenarios to base scenarios is just about restoring state (or reseting to initial to be precise whereas I propose travelling back to point in time).Paweł Pacanahttps://www.blogger.com/profile/13615579177920306392noreply@blogger.comtag:blogger.com,1999:blog-7821856652257554779.post-25384314827554516082011-04-26T23:02:19.772+02:002011-04-26T23:02:19.772+02:00@Pawel
Other way would be to just trigger each ev...@Pawel<br /><br />Other way would be to just trigger each event only once.<br /><br />Looking forward to your experiment with database savepoints! It may help, but I'm still not sure if that's the right direction. I'd prefer to be database independent in my acceptance tests.Andrzej Krzywdahttps://www.blogger.com/profile/06399276063142826365noreply@blogger.comtag:blogger.com,1999:blog-7821856652257554779.post-71964305050060426732011-04-26T22:52:47.131+02:002011-04-26T22:52:47.131+02:00Nice article. What I also like in this approach is...Nice article. What I also like in this approach is the ability to control how many times side scenarios should be executed. We can execute them for every event occurence or just once.<br /><br />I would probably try database savepoints for maintaining state in a single use-case (e.g. http://dev.mysql.com/doc/refman/5.0/en/savepoint.html)Paweł Pacanahttps://www.blogger.com/profile/13615579177920306392noreply@blogger.comtag:blogger.com,1999:blog-7821856652257554779.post-38755344956039761102011-04-26T18:19:36.848+02:002011-04-26T18:19:36.848+02:00As I said, it's too early to find answers to a...As I said, it's too early to find answers to all questions. The point that bothers you is the crucial one.<br /><br />It's hard to discuss it without an example.<br /><br />So far, where we found the need to change the state we created a new base scenario, but it made sense in our case.<br /><br />I'm not going to try the deep-cloning/transactions solutions :) Sounds scary to me and I want to avoid it.<br /><br />Editing a product description sounds like a good side scenario although it temporarily changes the state - at the end of the scenario we just edit it to the original version.Andrzej Krzywdahttps://www.blogger.com/profile/06399276063142826365noreply@blogger.comtag:blogger.com,1999:blog-7821856652257554779.post-49187922634194791802011-04-26T18:10:58.333+02:002011-04-26T18:10:58.333+02:00It looks interesting. Especially getting rid of fi...It looks interesting. Especially getting rid of fixtures/factories without affecting the performance. <br /><br />Although one point bothers me a bit:<br /><br /><i>the side scenarios have to leave the application state unchanged</i><br /><br />So either you have to make side scenarios read-only or deal with deep-cloning and nested database transactions. <br />How do you deal with that problem?Unknownhttps://www.blogger.com/profile/03361200848023752374noreply@blogger.com