Files
2012-02-21 01:15:00 -05:00

1 line
6.7 KiB
JSON

[{"user_id": 8192, "stars": [], "topic_id": 18834, "date_created": 1302585226.4212241, "message": "recently, there was a discussion about rspec in the rails community, and as I'm new, I would like to ask: Why is rspec better than Test::Unit? I understand the arguments by David Heinemeier Hansson, but I've seen no arguments pro rspec. Can you tell me why it is better in your opinion?", "group_id": 447, "id": 638168}, {"user_id": 28862, "stars": [], "topic_id": 18834, "date_created": 1302607818.0928841, "message": "The ones I've read seem to boil down to \"easier\" and \"closer to English\". I can't say I have a real preference. Test:Unit and RSpec are both really easy to use.", "group_id": 447, "id": 640529}, {"user_id": 4221, "stars": [], "topic_id": 18834, "date_created": 1302609220.5436881, "message": "RSpec is driven on the style called Behavior Driven Development, or BDD.", "group_id": 447, "id": 640902}, {"user_id": 4221, "stars": [], "topic_id": 18834, "date_created": 1302609307.440516, "message": "with RSpec, alot of the syntax is driven around what behaviors you're trying to get to work. As such, you get methods like \".should\" that let you describe what the method should do. the \"describe\" and \"it\" blocks allow you to describe module behavior.", "group_id": 447, "id": 640919}, {"user_id": 4221, "stars": [], "topic_id": 18834, "date_created": 1302609335.3881609, "message": "It's really just a different way of organizing your thoughts around \"what should my module do?\" and not \"does my module work?\"", "group_id": 447, "id": 640925}, {"user_id": 4221, "stars": [{"date_created": 1302620796.704016, "user_id": 22924}], "topic_id": 18834, "date_created": 1302609404.5650339, "message": "You cna get good code either way, but if you focus too heavily on the \"my module should work\" you can get into a case where you forget what it's part in the larger picture of things is supposed to do. With RSpec, you tend to lean on the thought that you'll only test as much as you need to ensure it behaves the way you want", "group_id": 447, "id": 640937}, {"user_id": 4221, "stars": [], "topic_id": 18834, "date_created": 1302609260.0054059, "message": "Test::Unit testing is the very basic, create a bunch of methods to test behvaiors, and Test::Unit will run the test suite or test methods. You don't really have any form to the tests, so you can do what you want.", "group_id": 447, "id": 640910}, {"user_id": 2576, "stars": [], "topic_id": 18834, "date_created": 1302623361.462692, "message": "Historically, Test::Unit is a port of CppUnit, which is a port of JavaUnit... it seems to follow a very functional simple style that mimics c++/java. For me, rspec is a testing framework written for ruby, and keeps the style of ruby. There's also a great deal of power in being able to see tests as \"executable specifications\", and being able to generate documentation from those tests. Now, with libraries like shoulda & riot that allow for an rspec-style syntax without having to replace Test::Unit, it's become less of an issue. But then, cucumber has come along and gained in popularity, and built on top of rspec.", "group_id": 447, "id": 644346}, {"user_id": 2576, "stars": [{"date_created": 1302844750.2265351, "user_id": 12202}], "topic_id": 18834, "date_created": 1302623418.826504, "message": "Me, I still prefer rspec (and not cucumber). Cucumber is maybe good if you're sharing your test writing with business folks, but otherwise I find it's much more useful to have your tests written in ruby.", "group_id": 447, "id": 644357}, {"user_id": 9327, "stars": [], "topic_id": 18834, "date_created": 1302629336.360538, "message": "IMO, rspec forces me to write better code via TDD, but I went from no tests, to cucumber/rspec, to full rspec. I think the bottom line is to pick a tool and stick with it to do tests, if you are good at test unit, use test unit, if you are good at rspec use rspec. If you don't know where to start pick one and learn it and start testing and start driving your development through testing. All tools will evolve and change overtime, the most important thing is to pick one and start testing.", "group_id": 447, "id": 646114}, {"user_id": 24926, "stars": [], "topic_id": 18834, "date_created": 1302635310.124604, "message": "@swindsor as the original author of test/unit, I have to quibble. test/unit was based on sunit, the first [x]unit written by Kent Beck and friends for Smalltalk. It's lineage is very much OO.", "group_id": 447, "id": 647696}, {"user_id": 4221, "stars": [], "topic_id": 18834, "date_created": 1302653612.1824689, "message": "@swindsor I wouldn't want to use Cucumber for really deep technical tests. I've been down that path with FitNesse (http://www.fitnesse.org) and that is a road to hell paved with good intentions.", "group_id": 447, "id": 653443}, {"user_id": 4221, "stars": [], "topic_id": 18834, "date_created": 1302653710.8186419, "message": "I didn't quite get the fuss about RSpec until I started using it. One of the best features it has is to be more of a bookmark for your thoughts when you step away from a project for a while. With Test::Unit, Java's JUnit,e tc., I felt that I left alot of holes in my understanding of what the hell I was trying to test, while I never had that much difficulty figuring out RSpec's tests, because they are really more english than method_that_looks_like_english()", "group_id": 447, "id": 653463}, {"user_id": 2576, "stars": [], "topic_id": 18834, "date_created": 1302706240.5815599, "message": "@ntalbott Sorry, didn't know about the history there from sunit. But, test/unit still seems like a port from other languages, and doesn't really feel like it fully utilizes some of the style and language features that ruby provides. I really like using the DSL and matchers way more than test_ methods and asserts. But it's totally a personal preference for me.", "group_id": 447, "id": 665840}, {"user_id": 2576, "stars": [], "topic_id": 18834, "date_created": 1302706403.8087449, "message": "@klauern Yeah, to be honest, I'm not 100% sold on Cucumber yet. It's a cool concept, but it might be trying to solve a much harder problem (parsing text phrases and turning them into code), that may not need to be solved in most cases. But, I haven't really embraced it and tried it with a real app, so I can't really say too strongly one way or another.", "group_id": 447, "id": 665874}, {"user_id": 24926, "stars": [], "topic_id": 18834, "date_created": 1302708131.0585041, "message": "@swindsor to be fair, it is/was a port, and it isn't as idiomatic as I'd like. I like some of the simple extensions Rails makes (`test \"something something\"` for instance) as basic syntactic improvements. Not a big rspec fan, though; put me in the old curmudgeons club.", "group_id": 447, "id": 666195}]