I want to start diving into BDD. I have never used TDD before and am
not sure if I should start by learning RSpec and then jump to Cucumber
or just go straight to using Cucumber.
I have been reading on the internet about both and it seems to me that
Cucumber could be a 'replacement' for RSpec. Am I right or should be
one used for certain things and the other one for others?
I want to start diving into BDD. I have never used TDD before and am
not sure if I should start by learning RSpec and then jump to Cucumber
or just go straight to using Cucumber.
Use both. RSpec is for unit tests, while Cucumber tests user-facing
features (and can use steps written in RSpec). Learn RSpec first, but
after getting the basics, learn Cucumber alongside it.
I have been reading on the internet about both and it seems to me that
Cucumber could be a 'replacement' for RSpec. Am I right or should be
one used for certain things and the other one for others?
Cucumber is absolutely not a replacement for RSpec. The two are
complementary. Cucumber is a replacement for integration tests.
There are the bddcasts: www.bddcasts.com
They do cost money, but they're worth it, so is the rspec book.
A word of advice:
Learning RoR at the same time with Cucumber and RSpec will require you
to fight a very steep learning curve.
Very often you will neither know how to test something nor how to
implement it. You do get a lot of insight into Rails and you'll learn
what every LOC does. But it's also over with easy copy&pasting code,
taking chunks from tutorials and all that. This requires for you to
really know what you're doing or if you don't - you will have to learn.
The quick and dirty solution with BDD doesn't exist. It can be worth it,
but it takes long.
I would suggest to get your Rails knowledge on a solid foundation first.
"Solid" means stuff you really know and can do - not a collage of
railscasts.
After that BDD won't be that hard.
There are the bddcasts: www.bddcasts.com
They do cost money, but they're worth it, so is the rspec book.
A word of advice:
Learning RoR at the same time with Cucumber and RSpec will require you
to fight a very steep learning curve.
Very often you will neither know how to test something nor how to
implement it. You do get a lot of insight into Rails and you'll learn
what every LOC does. But it's also over with easy copy&pasting code,
taking chunks from tutorials and all that. This requires for you to
really know what you're doing or if you don't - you will have to learn.
The quick and dirty solution with BDD doesn't exist. It can be worth it,
but it takes long.
I would suggest to get your Rails knowledge on a solid foundation first.
"Solid" means stuff you really know and can do - not a collage of
railscasts.
After that BDD won't be that hard.
Hope that helps
Ray
My approach has been:
- use the Agile web development with Rails book to get my 'rails
beginner badge'
- used forums such as these and the excellent stuff over on
railscasts.com to help bed the knowledge in a bit
- Developed my first basic app and deployed it on Heroku
With the basics in place I've now picked up the RSpec book and it seems
to be at the right time. I have a couple of rails apps in the pipeline
and would like to approach them using BDD and with the bsic rails
knowledge i have the book is making sense. It helps that I have alot of
experience in software testing and i can comfortably see where the
boundary between rspec and cucumber exists (and also where other tools
such as selenium and webrat pick up as well).
Just to echo the previous poster though - i'd recommend getting the
rails basics down first and perhaps develop a small application of your
own as well.
There are the bddcasts: www.bddcasts.com
They do cost money, but they're worth it, so is the rspec book.
A word of advice:
Learning RoR at the same time with Cucumber and RSpec will require you
to fight a very steep learning curve.
Very often you will neither know how to test something nor how to
implement it. You do get a lot of insight into Rails and you'll learn
what every LOC does. But it's also over with easy copy&pasting code,
taking chunks from tutorials and all that. This requires for you to
really know what you're doing or if you don't - you will have to learn.
The quick and dirty solution with BDD doesn't exist. It can be worth it,
but it takes long.
That's absolutely false. I learned Rails and RSpec at the same time
(Cucumber didn't exist yet).
It was no problem.
I would suggest to get your Rails knowledge on a solid foundation first.
"Solid" means stuff you really know and can do - not a collage of
railscasts.
After that BDD won't be that hard.
No, no, no! Then you'll be writing untested code, which is worse.
Definitely don't go for the collage of Railscasts, but don't hold off on
learning proper testing either. It's an essential part of programming
in the 21st century.
Well, unfortunately untested code is part of reality. Although I have
tried to be good and test all I could I have not followed a
methodology or tool to get things done right the first time and be
more efficient at it and I am sure there are parts of my code that I
missed, reason why I am so interested in BDD.
Ruby and Rails should not be a major problem. Although I am no expert
I can push my way through getting scratched by thorns and everything
else in the process. Although at times painful, I have learned a
lot so far.
Thank you all very much for your ideas and the will to share your
knowledge.
Ruby and Rails should not be a major problem. Although I am no expert
I can push my way through getting scratched by thorns and everything
else in the process. Although at times painful, I have learned a
lot so far.