tdd

BDD/TDD: can dependencies be a behavior?

左心房为你撑大大i 提交于 2019-12-08 02:20:41
问题 I've been told not to use implementation details. A dependency seems like an implementation detail. However I could phrase it also as a behavior. Example: A LinkList depends on a storage engine to store its links (eg LinkStorageInterface). The constructor needs to be passed an instance of an implemented LinkStorageInterface to do its job. I can't say 'shouldUseLinkStorage'. But maybe I can say 'shouldStoreLinksInStorage'. What is correct to 'test' in this case? Should I test that it stores

Eclipse plugins that supports TDD

风格不统一 提交于 2019-12-07 17:01:04
问题 do you know about some interesting Eclipse plugins that supports Test driven development? 回答1: Infinitest and JUnitMax do "Continuos Testing". All your tests are run in the background and testing errors appear as error annotations as if they are compiler errors. Interesting indeed ;). http://infinitest.github.com/ http://www.threeriversinstitute.org/junitmax/ 回答2: Pulse is a visually nice plugin that lets you track your TDD flow. http://www.happyprog.com/pulse/ 来源: https://stackoverflow.com

What are the good practice to test/inject private field in C#

我的梦境 提交于 2019-12-07 13:10:07
问题 My apologies if this a duplicate. I have been given the task to add some coverage for the method and been told to mock the private List<string> property. My question is: Is there a way to test private fields? The solution I found is adding new constructor just to inject this private list. I am not sure whether this is the right way, so any help will be highly appreciated. public class Class1 { public Class1(List<string> list)//This is just for Unit Testing { list1 = list; } private readonly

Why do Unit Test systems include useless assertive methods? [closed]

你。 提交于 2019-12-07 11:19:48
问题 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 5 years ago . I'm wondering why unittest systems like PHPUnit include what seems to be repetitive operators that just add overhead to the unit tests. I can understand a couple of those methods, but most seem like a total waste of time. public function testPop(array stack) { this-

Should TDD and BDD be used in conjunction?

牧云@^-^@ 提交于 2019-12-07 07:32:32
问题 I am coming from a TDD mindset into BDD. I understand that using BDD is to focus on ensuring the behaviours and business goals of software are being met. What confuses me is that if I start using BDD in place of TDD, it seems I'm not able to test at such a low-level. For example, when writing a test with a TDD mindset, I might test that properties have been attached to the scope: it('should attach properties to scope', function () { expect(MainCtrl.items.length).toEqual(1); }); In doing this,

TDD in ASP.NET MVC: where to start?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 07:20:52
问题 I'd like to start with TDD in ASP.NET NVC. Getting links pointing me to some ressources for absolute beginners on that matter would be helpfull. (why, when, how to write tests). Also, some advices on how to tackle the subject are welcomed. Thanks for helping 回答1: Phil Haack: http://haacked.com/archive/2007/12/07/tdd-and-dependency-injection-with-asp.net-mvc.aspx CodeBetter: http://codebetter.com/blogs/jeremy.miller/archive/2006/02/01/137457.aspx 4 Guys from Rolla: http://www.4guysfromrolla

How to keep rspec tests DRY with lots of “have_link”

眉间皱痕 提交于 2019-12-07 06:57:18
问题 I'm new to Ruby on Rails and I'm doing http://ruby.railstutorial.org right now. From what I understand the language is supposed to follow this DRY standard wery strictly but it's so WET when it comes to test driven development in this tutorial. For example it { should have_link('Users', href: users_path) } it { should have_link('Profile', href: user_path(user)) } it { should have_link('Settings', href: edit_user_path(user)) } it { should have_link('Sign out', href: signout_path) } Here we

Test-driven development for JSPs specifically

旧巷老猫 提交于 2019-12-07 06:47:47
问题 I've been writing test-driven code even before understanding what TDD actually was. Calling functions and classes without having its implementation helps me understand and build my application in a much faster and efficient way. So I'm very used the process of writing code->compiling it->seeing it fail->fixing it by building its implementation. This process is a bit harder for the Web. Specifically JSPs. When I compile my Java classes, all it's fine, I can see the compile errors. However

Proper unit testing technique

故事扮演 提交于 2019-12-07 06:41:38
问题 While Using TDD I found myself needing to test a constant (final) hashmap which contains lookup values ( PLEASE SEE REASON WHY THIS WAS THE CASE UNDER UPDATE ) See below private static final Map<Integer,String> singleDigitLookup = new HashMap<Integer, String>(){{ put(0,"Zero");put(1,"One");put(2,"Two");put(3,"Three");put(4,"Four");put(5,"Five");put(6,"Six");put(7,"Seven"); put(8,"Eight");put(9,"Nine"); }}; With TDD its stressed to test one thing at a time so i started calling my class

Have you been in cases where TDD increased development time?

↘锁芯ラ 提交于 2019-12-07 06:07:11
问题 I was reading TDD - How to start really thinking TDD? and I noticed many of the answers indicate that tests + application should take less time than just writing the application. In my experience, this is not true. My problem though is that some 90% of the code I write has a TON of operating system calls. The time spent to actually mock these up takes much longer than just writing the code in the first place. Sometimes 4 or 5 times as long to write the test as to write the actual code. I'm