86 ms·
I don't program in Ruby. I write Python so Lettuce (http://lettuce.it/ http://lettuce.it/) is the obvious Python binding to use. I've only used Lettuce once and
by yeukhon 13y ago
I don't program in Ruby. I write Python so Lettuce (http://lettuce.it/ http://lettuce.it/) is the obvious Python binding to use. I've only used Lettuce once and I had an awful experience. That was a two years ago.
I like writing tests though my experience with software development has been limited to school projects, personal projects and intern projects. Nothing major. Nothing at the scale of ecommerce or Google scale.
But one thing I learned from writing tests (unit tests, integration tests and functional tests) is that do what is straightforward and don't worry about the strict TDD cycle. I worry about logging and error messages.
I've spent a whole week learning Lettuce. At that time the research project I was working on lacked tests (the project was using Django). I was told to look up Lettuce because writing Lettuce tests is like writing stories.
My awful experience was trying to wrap my head around the framework, trying to do many things that would take many steps and many tricks to complete. The table was awful. I didn't like it.
I gave up. I turned back to the built-in unittests module. I wrote some tests and from that point the only testing framework I have to add is the mock library. When I need an isolated unit tests I would call mock. When I need to test integration between modules without involving database calls or HTTP requests I will use mock.
Testing should be straightforward and should remain simple. Maybe Cucumber works nicely with Ruby's RSpec (I heard a lot about rspec and how rspec is so awesome and helpful for testing, not sure if that's true since I am a Python developer).
I also don't think writing a million test cases will work. In the end, while I think unit tests and integration tests are useful and awesome, I like to catch up with my functional tests. Most of my tests are done on the server side (so just use requests library to make HTTP calls). Depending on what kind of application you are testing, the testing tools can vary.
In the end, keep your tests simple. If something breaks, you better fix it quickly.
Logging , incidents collection and error messages are the most important thing in deployment and testing. If I have to spend hours to trace down the bug (the process died half way) or user is confused why the service is not working properly, I will waste more cycles to build my product.
- shanemhansen 13y agoI've had pretty bad experiences with mocking frameworks. I try to keep all my tests straight-up python unittests. Forcing yourself to setup and tear down classes and their dependencies in a few lines of code while also keeping the ability to swap out dependencies improves my design by an order of magnitude. I've had projects that were incredibly hard to change due to mocked out database and network dependencies. That being said, I've occasionally resorted to mock when I'm stuck with crappy code that needs to be put under test before refactoring.
- yeukhon 13y agoI am okay with mock. I was an early adopter of mock so I had the same struggle. Well, I agree there is a big learning curve using mock. When I mock I get lazy I mock a lot of things out. If the project has to spawn processes or do a lot crazy network stuff I just forget about mocking and true unittest. I go straight with functional tests.