tdd

BDD framework for the frontend?

混江龙づ霸主 提交于 2019-12-03 05:06:09
问题 On the server side we have Rspec/Cucumber for BDD development (ruby) vowsjs (node.js) Is there a BDD frameworks to use on web browsers (not qUnit or YUI test since these are only for TDD)? 回答1: Check out jasmine describe("Jasmine", function() { it("makes testing JavaScript awesome!", function() { expect(yourCode).toBeLotsBetter(); }); }); http://pivotal.github.com/jasmine/ https://github.com/pivotal/jasmine Should_be ( sic ) very familiar to a ruby person 回答2: You could also look at Yadda.

How to attach message to rspec check?

北城以北 提交于 2019-12-03 04:43:36
问题 In rspec: Can I attach a message to a check the same way as I would do in xUnit style test frameworks? How? assert_equal value1, value2, "something is wrong" 回答1: should and should_not take a second argument ( message ) that overrides the matcher’s default message. 1.should be(2), 'one is not two!' The default messages are usually pretty useful though. update: for RSpec 3: expect(1).to eq(2), "one is not two!" 回答2: In RSpec, it's the matcher's job to print a sensible failure message. The

Is there a difference between TDD and Test First Development (or Test First Programming)?

点点圈 提交于 2019-12-03 04:41:18
问题 Both ideas sound very similar to me, but there might be subtle differences or the exact same thing, explained in different ways. What is the relationship between TDD and Test First Development/Programming? 回答1: There's a difference in terms of what the driving factor is. Do you have a vague idea of what the class (or system - this can happen at different scales, of course) should look like, then think up tests which give it the actual shape? That's TDD. Do you know exactly what the public API

Good resource to learn BDD, TDD (ruby , C#, javascript)

喜夏-厌秋 提交于 2019-12-03 04:38:36
问题 What are the good resource to learn BDD & TDD (ruby , C#, javascript). What are the good framework using now? 回答1: See Why should I practice Test Driven Development and how should I start? Beginning TDD - Challenges? Solutions? Recommendations? Good C# Unit testing book Introducing BDD What is the Path to Learn BDD on Ruby On Rails? Jasmine Hanselminutes - Understanding BDD and NSpec 回答2: I can't really speak with too much authority on this subject, nor will I speak with too greater vigour

Zend Framework integration with Behat BDD

让人想犯罪 __ 提交于 2019-12-03 04:24:56
问题 Anyone has been using Behat with Zend Framework? Any examples on how to use both? 回答1: I got it working. It works with PHPUnit and Zend_Test so you can use all those nifty assertXYZ() methods. First, make sure you've got behat installed and available in your system $PATH . I did the following: sudo pear channel-discover pear.symfony.com sudo pear channel-discover pear.behat.org sudo pear install behat/behat Now, create a directory structure like so: features application ControllerTestCase.php

C#: How would you unit test GetHashCode?

断了今生、忘了曾经 提交于 2019-12-03 04:19:16
Testing the Equals method is pretty much straight forward (as far as I know). But how on earth do you test the GetHashCode method? Test that two distinct objects which are equal have the same hash code (for various values). Check that non-equal objects give different hash codes, varying one aspect/property at a time. While the hash codes don't have to be different, you'd be really unlucky to pick different values for properties which happen to give the same hash code unless you've got a bug. Gallio/MbUnit v3.2 comes with convenient contract verifiers which are able to test your implementation

Using TDD: “top down” vs. “bottom up”

人盡茶涼 提交于 2019-12-03 04:19:06
问题 Since I'm a TDD newbie, I'm currently developing a tiny C# console application in order to practice (because practice makes perfect, right?). I started by making a simple sketchup of how the application could be organized (class-wise) and started developing all domain classes that I could identify, one by one (test first, of course). In the end, the classes have to be integrated together in order to make the application runnable, i.e. placing necessary code in the Main method which calls the

Mock objects - Setup method - Test Driven Development

孤者浪人 提交于 2019-12-03 04:08:42
问题 I am learning Test Driven Development and trying to use Moq library for mocking. What is the purpose of Setup method of Mock class? 回答1: The default behaviour of a Moq Mock object is to stub all methods and properties. This means that a call to that method/property with any parameters will not fail and will return a default value for the particular return type. You call Setup method for any or all of the following reasons: You want to restrict the input values to the method. public interface

After using Automapper to map a ViewModel how and what should I test?

社会主义新天地 提交于 2019-12-03 03:56:24
问题 I am attempting to test the Index action of a controller. The action uses AutoMapper to map a domain Customer object to a view model TestCustomerForm . While this works I am concerned about the best way to test the results that I am receiving from the Index action. The controller's index action looks like this: public ActionResult Index() { TestCustomerForm cust = Mapper.Map<Customer, TestCustomerForm>(_repository.GetCustomerByLogin(CurrentUserLoginName)); return View(cust); } And its

Test Driven Development with C++

青春壹個敷衍的年華 提交于 2019-12-03 03:47:08
问题 Looking to start doing TDD in C++. I've seen CPPUnit, but I was wondering if there are other options that people prefer? Thanks for your suggestions! 回答1: I can recommend Google Mock. It comes with a copy of Google Test bundled. We switched from UnitTest++ too Google Test/Google Mock a couple of years ago and have never looked back. Google Mock can be used even if you don't want to use the mocking facilities. Its matchers are very useful. 回答2: I switched from CppUnit to boost::test some years