tdd

eslint should be listed in the project's dependencies, not devDependencies

纵饮孤独 提交于 2019-12-02 19:02:29
Either I don't understand dependencies vs. devDependencies in node 100% yet or eslint is just wrong here (not capable of analyzing this correctly): 3:1 error 'chai' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 4:1 error 'chai-enzyme' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 5:1 error 'enzyme' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 7:1 error 'sinon' should be listed in the project's dependencies, not devDependencies

How to attach message to rspec check?

99封情书 提交于 2019-12-02 19:01:51
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" Chris Johnsen 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!" Jörg W Mittag In RSpec, it's the matcher's job to print a sensible failure message. The generic matchers that ship with RSpec can obviously only print generic non-descript

How does TDD make refactoring easier?

前提是你 提交于 2019-12-02 18:57:14
I've heard that projects developed using TDD are easier to refactor because the practice yields a comprehensive set of unit tests, which will (hopefully) fail if any change has broken the code. All of the examples I've seen of this, however, deal with refactoring implementation - changing an algorithm with a more efficient one, for example. I find that refactoring architecture is a lot more common in the early stages where the design is still being worked out. Interfaces change, new classes are added & deleted, even the behavior of a function could change slightly (I thought I needed it to do

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

早过忘川 提交于 2019-12-02 18:55:15
What are the good resource to learn BDD & TDD (ruby , C#, javascript). What are the good framework using now? Eugene Yokota 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 I can't really speak with too much authority on this subject, nor will I speak with too greater vigour given how storongly people feel about those two acronyms but it seams as though you are new to BDD /

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

拈花ヽ惹草 提交于 2019-12-02 18:38:16
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 necessary logic. However, I don't see how I can do this last integration step in a "test first" manner.

How do you do TDD in a non-trivial application? [closed]

∥☆過路亽.° 提交于 2019-12-02 18:21:53
I've read a number of books and websites on the subject of TDD, and they all make a lot of sense, especially Kent Beck's book. However, when I try to do TDD myself, i find myself staring at the keyboard wondering how to begin. Is there a process you use? What is your thought process? How do you identify your first tests? The majority of the books on the subject do a great job of describing what TDD is, but not how to practice TDD in real world non-trivial applications. How do you do TDD? I used to have the same problem. I used to start most development by starting a window-designer to create

BDD framework for the frontend?

删除回忆录丶 提交于 2019-12-02 18:20:10
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)? 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 You could also look at Yadda . Rather than being a standalone test framework like CucumberJS, it enables to use a Gherkin like syntax from other

TDD, DDD and Encapsulation

≡放荡痞女 提交于 2019-12-02 18:08:27
After several years of following the bad practice handed down from 'architects' at my place of work and thinking that there must be a better way, I've recently been reading up around TDD and DDD and I think the principles and practices would be a great fit for the complexity of the software we write. However, many of the TDD samples I have seen call a method on the domain object and then test properties of the object to ensure the behaviour executed correctly. On the other hand, several respected people in the industry (Greg Young most noticeably so with his talks on CQRS) advocate fully

How to unit test a method whose side effect is to call other method?

孤街醉人 提交于 2019-12-02 17:59:30
问题 Here is my example: void doneWithCurrentState(State state) { switch (state) { case State.Normal: // this method is never actually called with State.Normal break; case State.Editing: controller.updateViewState(State.Normal); database.updateObjectWithDetails(controller.getObjectDetailsFromViews()) break; case State.Focus: controller.updateViewState(State.Editing); break; } } My controller calls the doneWithCurrentState when a specific button is pressed. The states are different positions on

C# Service Layer Design Pattern

旧城冷巷雨未停 提交于 2019-12-02 17:44:07
We are looking into creating a new project and are wanting to explore using the Repository and Service layer patterns, the aim to is create loosely coupled code which is fully testable using mock repositories. Please see below the basic architecture idea. We will be using interfaces to describe the repositories and inject these into the service layers to remove any dependencies. Then using autofac we will wire up the services at runtime. public interface IOrderRepository { IQueryable<Order> GetAll(); } public class OrderRepository : IOrderRepository { public IQueryable<Order> GetAll() { return