Slow Tests Are the Symptom, Not the Cause
re-factor.com
Slow Tests Are the Symptom, Not the Cause
1–10 of 46 posts
Re: Slow Tests Are the Symptom, Not the Cause
#2This feels like how Spring must have been born. Trying to think of an alternative, and I think I would be happy with the fat controller example originally given. It's simple enough and straight forward.
Perhaps it's just bad examples all the way around...
Re: Slow Tests Are the Symptom, Not the Cause
#3Re: Slow Tests Are the Symptom, Not the Cause
#4In an app designed like this the integration tests are the useful ones, because they're more contentful and test assumptions that are more likely to be wrong. The article flatly asserts that code written in this extremely decoupled style will require fewer integration tests, but I see no evidence for this. And you still need to figure out how to make them run fast.
Re: Slow Tests Are the Symptom, Not the Cause
#5http://blog.codeship.io/2013/08/21/faster-test-suite-boot-ti...
http://blog.codeship.io/2012/11/15/speeding-up-our-test-suit...
Re: Slow Tests Are the Symptom, Not the Cause
#6Not a fan of the way the link jumps to the Disqus comments rather than just being at the top of the page
Re: Slow Tests Are the Symptom, Not the Cause
#7Was mostly with the author right up until he shows an example of the worst possible unit test. Testing the implementation and not the intent. This feels like how Spring must have been born. Trying to think of an alternative, and I think I would be happy with the fat controller example originally given. It's simple enough and straight forward. Perhaps it's just bad examples all the way around...
Tests for these "director" style methods must by nature assert that all the right messages were forwarded to the right objects under the right circumstances, so yes, you do end up with tests that look a lot like what they're testing.
Agreed that ideally you are only testing ins and outs though, but I think this case was exceptional.
Re: Slow Tests Are the Symptom, Not the Cause
#8Was mostly with the author right up until he shows an example of the worst possible unit test. Testing the implementation and not the intent. This feels like how Spring must have been born. Trying to think of an alternative, and I think I would be happy with the fat controller example originally given. It's simple enough and straight forward. Perhaps it's just bad examples all the way around...
As for the testing issue, we have a controller-like object there, and a controller’s job is to coordinate sending messages between collaborators so I don't think a unit test for this object should test anything than these interactions. This also might be a consequence of using a simple example.
Re: Slow Tests Are the Symptom, Not the Cause
#91: Added a users resource beneath the mailing list, ie
resources :users
resources :mailing_lists do
resources :users
end
add_foo is almost always a sign that a new nested controller should be made, and there is almost always a need for a delete as well - in this case users should be able to remove themselves from a mailing list.2: Put the add method on the mailing list and not on the user, because that is where I'd expect the least logic to be.
because:
3: I'd put the actual mailing list mailer logic in a separate class for the configuration of it.
Re: Slow Tests Are the Symptom, Not the Cause
#10Was mostly with the author right up until he shows an example of the worst possible unit test. Testing the implementation and not the intent. This feels like how Spring must have been born. Trying to think of an alternative, and I think I would be happy with the fat controller example originally given. It's simple enough and straight forward. Perhaps it's just bad examples all the way around...
I think this was only a poor example because the method under test was a "director" style method (not sure what the name of it would actually be) that simply forwards a bunch of messages/commands to other objects and doesn't do much actual logic/computation. Tests for these "director" style methods must by nature assert that all the right messages were forwarded to the right objects under the right circumstances, so…