tdd

What is the difference between a Seam and a Mock?

∥☆過路亽.° 提交于 2019-12-20 10:42:31
问题 Its being a few months since I am working with java legacy code, this are some of the things I am dealing with: 0% test coverage. Huge functions in occasions I even saw some with more than 300 lines of code. Lots of private methods and in occasions static methods. Highly tight coupled code. At the beginning I was very confused, I found difficult to use TDD in the legacy. After doing katas for weeks and practicing my unit testing and mocking skills, my fear has decreased and I feel a bit more

State of unit testing for Windows Phone

女生的网名这么多〃 提交于 2019-12-20 10:27:26
问题 I've been pushing my Google Fu to the limits trying to find the most recommended / stable setup for doing TDD + CI for Windows Phone applications. Can anyone who has successfully been doing this point me in the right direction? Here's what I want to be able to do (if it's possible): Write unit tests for view models and application services that don't require phone functionality Execute tests directly in Visual Studio via Resharper or TD.NET Execute the unit tests from the command line with

How do you run your unit tests? Compiler flags? Static libraries?

柔情痞子 提交于 2019-12-20 09:56:23
问题 I'm just getting started with TDD and am curious as to what approaches others take to run their tests. For reference, I am using the google testing framework, but I believe the question is applicable to most other testing frameworks and to languages other than C/C++. My general approach so far has been to do one of three things: Write the majority of the application in a static library, then create two executables. One executable is the application itself, while the other is the test runner

First Shot at Testing Laravel 4 apps (PHPSpec/BDD vs. PHPUnit/TDD)

戏子无情 提交于 2019-12-20 09:56:18
问题 I have been wrestling with this question for far too long now. I know I need to just jump into one or the other since they are both obviously viable/useful tools, but have been stuck on the fence, researching both, for weeks. PHPUnit vs. PHPSpec - Which one may lead to better long-term maintainability and programming practices? I have talked to several seasoned PHPUnit -> PHPspec converts/users who now swear by PHPspec, claiming that it promotes better design thanks to its BDD approach.

Unit Testing: Logging and Dependency Injection

好久不见. 提交于 2019-12-20 09:56:01
问题 So regards logging from SO and other sites on the Internet the best response seems to be: void DoSomething() { Logger.Log("Doing something!"); // Code... } Now generally you'd avoid static methods but in the case of logging (a special case) this is the easiest and cleaniest route. Within the static class you can easily inject an instance via a config file/framework to give you the same effect as DI. My problem comes from a unit testing perspective. In the example code above imagine the point

nodejs mocha suite is not defined error

时光总嘲笑我的痴心妄想 提交于 2019-12-20 09:51:09
问题 I am trying to run some tests using mocha but cant seem to get over this error. E:\tdd\nodejs\cart>mocha cart.test.js node.js:201 throw e; // process.nextTick error, or 'err ^ ReferenceError: suite is not defined at Object.<anonymous> (E:\tdd\nodejs\cart\cart.test.js:5:1 at Module._compile (module.js:432:26) at Object..js (module.js:450:10) at Module.load (module.js:351:31) at Function._load (module.js:310:12) at Module.require (module.js:357:17) at require (module.js:368:17) at C:\Users\lex

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

╄→尐↘猪︶ㄣ 提交于 2019-12-20 09:19:14
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . 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

“Hello World” - The TDD way?

丶灬走出姿态 提交于 2019-12-20 09:03:22
问题 Well I have been thinking about this for a while, ever since I was introduced to TDD. Which would be the best way to build a "Hello World" application ? which would print "Hello World" on the console - using Test Driven Development. What would my Tests look like ? and Around what classes ? Request: No " wikipedia-like " links to what TDD is, I'm familiar with TDD. Just curious about how this can be tackled. 回答1: You need to hide the Console behind a interface. (This could be considered to be

How to use Capybara in pure Ruby (without Rails)?

拈花ヽ惹草 提交于 2019-12-20 08:48:15
问题 I'm trying to get Capybara running in a simple Ruby script -- i.e. without/outside of Rails. Here's the script: require 'rubygems' require 'capybara' require 'capybara/dsl' include Capybara Capybara.current_driver = :selenium Capybara.app_host = 'http://www.google.com' visit('/') The problem is that when I run this I get this error: NameError: uninitialized constant Capybara::Session at top level in dsl.rb at line 52 method gem_original_require in custom_require.rb at line 36 method require

Should unit tests be written before the code is written?

∥☆過路亽.° 提交于 2019-12-20 08:41:05
问题 I know that one of the defining principles of Test driven development is that you write your Unit tests first and then write code to pass those unit tests, but is it necessary to do it this way? I've found that I often don't know what I am testing until I've written it, mainly because the past couple of projects I've worked on have more evolved from a proof of concept rather than been designed. I've tried to write my unit tests before and it can be useful, but it doesn't seem natural to me.