It can definitely be tempting to tie up all loose ends at the end of the day. I've found that shutting down my laptop and cleaning up my workspace right after I've written the failing test can help me move on.
I do use TDD pretty regularly, and this idea has fit well within the red-green-refactor cycle for me.
I work mostly with Ruby and JavaScript. I use RSpec for most of my Ruby testing, including unit tests. I haven't done much unit testing in JavaScript, but I'll test interactions with JavaScript in the browser using Capybara and ChromeDriver.
I generally try to avoid mocking whenever possible.
When I'm testing requests to external services in Ruby, I'll use VCR and WebMock so that my test suite doesn't need to make HTTP requests, and when I'm testing how an application handles webhook events, I'll write fixtures to fake the payloads of incoming requests. Very occasionally I'll reach for the mocking built into RSpec for other purposes.
I understand what you mean, but mocks can help you test more cases, thus you can be confident that the thing you're testing works on edge cases too, don't you think?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks!
It can definitely be tempting to tie up all loose ends at the end of the day. I've found that shutting down my laptop and cleaning up my workspace right after I've written the failing test can help me move on.
I do use TDD pretty regularly, and this idea has fit well within the red-green-refactor cycle for me.
I'll try that :)
Which languages do you work with? do you use any unit testing/mocking frameworks?
I work mostly with Ruby and JavaScript. I use RSpec for most of my Ruby testing, including unit tests. I haven't done much unit testing in JavaScript, but I'll test interactions with JavaScript in the browser using Capybara and ChromeDriver.
Sounds interesting :)
Any suggestions for mocking frameworks for the server side?
I generally try to avoid mocking whenever possible.
When I'm testing requests to external services in Ruby, I'll use VCR and WebMock so that my test suite doesn't need to make HTTP requests, and when I'm testing how an application handles webhook events, I'll write fixtures to fake the payloads of incoming requests. Very occasionally I'll reach for the mocking built into RSpec for other purposes.
But for the most part, I tend to avoid mocking.
Why do you tend to avoid mocking?
When it's feasible, testing the real system rather than mocks gives me more confidence that the thing I'm testing actually works.
I understand what you mean, but mocks can help you test more cases, thus you can be confident that the thing you're testing works on edge cases too, don't you think?