Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
TDD stands for Test-Driven Development, or Test-Driven Design. It is the practice of writing a unit test before writing code to satisfy it, in what is known as the Red-Green-Refactor cycle.
1
vote
How to get initial API right using TDD?
You can still start with TDD very early, to verify your first design scetches, but you have to refactor your test code similar to production code as soon as code duplication happens, so you don't paint …
8
votes
Can any programming language infer domains of a function from the domains of its input funct...
Let D(f) be the domain of a function f, C(f) its codomain and & the intersection operator. Let further g^-1(M) the domain values of g which map into a certain set M. Then one can write the domain of i …
3
votes
Is it good practice to check the requirement multiple times?
In TDD, you usually start with one test:
def test_Cal(self):
self.assertEqual(Calculator.cal(self,1,2),3)
(Let's assume your goal is to make cal just to add its inputs). … This is why I prefer to think about TDD as a "white-box" testing technique: even if you design tests before any code is written, you make decisions about adding more tests by using your knowledge about …
8
votes
Accepted
How to practice TDD when I constantly need to ditch my current test?
I voted to close this question as a duplicate, because I think this case can be solved by applying this answer, but let me explain it a little bit more in-depth by using your specific example.
The pro …
1
vote
Writing unit test only for applications that requires them
company owner: "all the devs here know how to do TDD, they'll do it when required".
It is pretty obvious that the company owner is running out of arguments and tries end up the discussion. … TDD is something you have to convince your dev colleagues of, and if they are willing to adopt it, then the company owner most probably won't resist. …
3
votes
Wrapping function in closures to make testable functions
IMHO it is not overkill, that is just the Javascript (or functional) form of the command pattern, used in conjunction with dependency injection.
The classic OO equivalent for achieving the same, is …
4
votes
Is it typical for a unit test suite to be larger than the code it tests?
This may indeed happen when you write lots of unit tests and do a lot of TDD. …
5
votes
Accepted
Workflow of Test driven development to follow SOLID principles
should I first write code against concrete type and afterwords (in refactoring or "make it right" phase?) make the code SOLID
Writing test code against a concrete type is fine, and it is not a vi …
10
votes
How to deal with test passing from the start in TDD
Tests passing right from the start will typically occur when one implemented something in a more general way than actually needed for the tests at hand. This is quite normal: unit tests can only provi …
2
votes
TDD when testable requirements are hard to come by
Sure, this is not "TDD by the book", but the design impact on your code will typically stay almost the same as if you had written the tests beforehand. …
5
votes
Is it still TDD if I follow the cycle for each method alone?
I mean, let's say I have 5 methods to test
That struck me as odd, because in my understanding of TDD, you never ever have 5 methods to test (at once). … If that is what you meant under #2, then it is TDD. But #1 has nothing to do with TDD, quite the opposite. …
5
votes
How does TDD behave when the tested unit needs to be expanded?
Now, the test is "green".
third, and that is step which is pretty important in TDD: refactor. … In TDD, that means, of course, writing tests first, then implement InvoiceRowFactory. …
2
votes
How to write the test for a class function which depends on another function to be tested in...
I think this is best understood by going through your example (in pseudocode):
let us assume class A already exists, by prior work (maybe TDD or not, does not matter), but it does not have add, display … Note TDD does not mean to write one test after another to add one function after another to a class. It is about writing one test after another to add some additional behaviour to a class. …
21
votes
Accepted
I'm confused about which is the correct way to work with TDD
if in TDD in theory you have to write first your test suit and build your code up from it
Here is your misunderstanding. … TDD is not about writing a full test suite first - that's is a false myth. …
3
votes
Accepted
Simulation Testing: how to test something that depends on its previous state
Even if the sequence becomes large, it is not necessarily an issue if your test sequence becomes equally large too, as long as
the running time isn't bothering you
the intermediate states are proper …