3 ms·
One good thing about killing the state each time is that... you kill the state. I'd be worried about testing an external service through http in this style. Is
by viraptor 16y ago
One good thing about killing the state each time is that... you kill the state. I'd be worried about testing an external service through http in this style. Is it completely stateless? What happens with the session? Can I test "cancel" on the same step if I already did "continue" on it? What if the order is different? What information do I have to rollback after trying each branch? etc.
I know he addresses it in the database example (<<For modern web applications, all the state is stored in a database. Therefore to make a "copy of the universe," we just need a way to make a copy of the database to pass down to the child tests>>), but then he follows with testing over http, where he doesn't save the state in any way. It's just a bit confusing this way.
If you do testing in the wrecking ball approach, at least those things are in plain view. Just kill the state every time. If it doesn't take more than a couple of min. to run all the tests, everything's all right.
- shoover 16y agoThe state is being saved in the http example, but you can't see it because it's a functional test at the http client level. Think of the test code as a script controlling a browser. boss_test:get_request and boss_test:follow_link are hitting the http server where all the state saving action occurs.
- viraptor 16y agoYes, but after get_request, you've got some data saved in your session (I'd assume that's the case for any multi-step flow over http). Now how do I guarantee that when I "continue" from step 2 and then "cancel" from step 2, I still have the correct session state to act on step 3?
- shoover 16y agoThat depends on the integration between the web server and the test framework. In this case the framework is rolling back some in-memory database. If the session state is in that database, you're good to go. Otherwise the framework needs to track whatever else you're using for session state and roll it back like it does the database.