65
votes
Accepted
How do I really write tests without mocking/stubbing?
This answer consists of two separate views on the same issue, as this isn't a "right vs wrong" scenario, but rather a broad spectrum where you can approach it the way it's most appropriate ...
39
votes
Is it a good idea to write all possible test cases after transforming the team to TDD to achieve a full coverage?
There was no test-driven development process during the development due to very tight deadlines
This statement is very concerning. Not because it means you developed without TDD or because you aren't ...
24
votes
Is it a good idea to write all possible test cases after transforming the team to TDD to achieve a full coverage?
Is it still okay or good idea to stop most of the development and start writing whole possible test cases from the beginning [...] ?
Given legacy1 code, write unit tests in these situations:
when ...
24
votes
How do I really write tests without mocking/stubbing?
How do I really write tests without mocking/stubbing?
You design your code such that it can be tested without mocking and stubbing.
That's one of the important, if perhaps subtle, ideas behind TDD: ...
20
votes
Accepted
Do test-driven and behavior-driven development belong to the "verification" category?
Is it a valid generalization to say that TDD and BDD are classified as "verification"?
No. TDD and BDD incorporate verification procedures into the development process in a specific way, ...
18
votes
Does BDD and DDD work well together?
Like @robert-harvey already pointed out, the ubiquitous language is ideally the common binding force.
DDD focuses on defining the vocabulary in that language: actors, entities, operations, ... An ...
17
votes
How do I really write tests without mocking/stubbing?
I'm self-proclaimed classicist myself, so let me clear things up a little.
First, the unit vs. integration tests. For me, 'unit' test is one that is independent of other tests and doesn't require any ...
16
votes
Accepted
Differences between Given When Then (GWT) and Arrange Act Assert (AAA)?
I think you listed the differences very well in your question, however I'll add some of my opinions regarding the two approaches.
AAA is very useful for me when I'm testing my own code. If I'm ...
14
votes
Do test-driven and behavior-driven development belong to the "verification" category?
Is it a valid generalization to say that TDD and BDD are classified as "verification"?
Yes. All testing techniques that take the customers specification as input (and therefor as the truth) ...
13
votes
What levels to test on with BDD/Cucumber?
If you can answer the question, "Can you give me an example of how X should behave?" then you can do BDD.
So, if you want to do BDD at a unit level, think of some examples of how that class or unit ...
12
votes
Is it a good idea to write all possible test cases after transforming the team to TDD to achieve a full coverage?
In my experience, tests do not need total coverage to be helpful. Instead, you start reaping different kinds of benefits as coverage increases:
more than 30% coverage (aka a couple of integration ...
11
votes
Differences between Given When Then (GWT) and Arrange Act Assert (AAA)?
There is no difference at all.
Three states of test:
Given = Arrange,
When = Act,
Then = Assert.
Differences you provided in the question is differences between TDD and BDD and not GWT and AAA.
In ...
10
votes
How do I really write tests without mocking/stubbing?
Let's get rid of labels such as mocks and stubs for a moment, and focus purely on the TDD process. You're starting to write the first test for UserService (I'm going to use your own example):
If ...
9
votes
How to do BDD for CRUD?
I built a mini CRUD application and I would like for someone to
complete it by adding the tests
If you are doing BDD you should have defined the required behaviour first. then written the tests, ...
9
votes
Accepted
How can Behavior-Driven Development be a form of Testing-Driven Development/Unit Testing?
TDD was invented by people who focused on behavior. Those people saw it take off and become popular. Once it was popular, it got into the hands of people who thought about TDD structurally. The TDD ...
8
votes
Accepted
How does Behavior Driven Development improves clarity when natural languages are ambiguous?
You are correct. BDD does not eliminate problems with language ambiguity - not at all. As others pointed out, the snippets that get translated need to be matched by properly defining them, but this ...
8
votes
Accepted
Migrate legacy requirements to BDD
I made the mistake of stripping a room down to the studs when I replaced its windows. It's an old house. The room was in bad shape. At every step along the way, I ran into issues. An old pipe crumbled ...
7
votes
Relation between BDD and TDD
My understanding of it:
BDD started as a rebranding of TDD to make the focus on behaviour clearer.
It gives more formal support (DSL and tooling) for a focus on behaviour and executable ...
7
votes
Accepted
What advantages are there to using a BDD test tool like SpecFlow over simple unit test tools like MSTest?
The term "BDD" was coined by some TDD practitioners to solve a specific problem: when teaching TDD, the most important hurdle to overcome, is to understand that TDD is not about testing.
Dan North ...
7
votes
How to do BDD for CRUD?
Requirements
Typically you will define the behavior before you write the code. These start out as somewhat vague high-level requirements:
unregistered users should be able to register
registered ...
6
votes
What advantages are there to using a BDD test tool like SpecFlow over simple unit test tools like MSTest?
The first thing to know is the the person that coined the BDD term (Dan North) doesn't use such tools. He uses standard unit test tools.
The supposed advantage is the easiness to transform structured ...
6
votes
Functional programming, Domain Driven Design, and Test/Behavior Driven Development
TDD proponents say no design is necessary ...
No, TDD proponents say allowing for tests in your design can only improve your design. They don't say you have an awesome design just because it's a ...
6
votes
How to do BDD for CRUD?
I believe you have two separate questions here. One is: how can BDD be applied to a CRUD app, and the second is: how can I use BDD to build a simple registration app.
BDD does not lend itself to ...
6
votes
How to convert from TDD scripts to BDD?
In practice, you can´t, because the concepts of TDD and BDD are different. Although both test behavior, when you use TDD you create low-level testing to ensure your methods/function is working as ...
6
votes
Do test-driven and behavior-driven development belong to the "verification" category?
Tests are a verification activity: they demonstrate that the software system exhibits certain behaviour.
However, the act of creating test cases can sometimes have validation-like aspects. TDD and BDD ...
5
votes
Accepted
Does BDD/TDD imply an automatable client?
tests that express a scenario need to have control over the client
Tests are a client. There is no "the client".
A client that uses a service relies on that service exhibiting a certain behavior. A ...
5
votes
Accepted
Functional programming, Domain Driven Design, and Test/Behavior Driven Development
First, some clarifications, since you expressed interest in checking your understanding:
Functional Programming (FP)
Functional programming is a paradigm in which the primary unit of program ...
5
votes
Differences between Given When Then (GWT) and Arrange Act Assert (AAA)?
I guess it's dependent upon the framework you're using. Generally, so far as my understanding, AAA is supported by the NUnit framework, and thus is the natural choice in that regard. As for the ...
5
votes
Testing a private method in Java
I'm having a hard time understanding exactly what it is that you're asking but it seems like your question is more to do with removing the usage of an actual HTTP request than anything to do with ...
5
votes
Accepted
Test RESTful APIs?
Testing the status could be a good sanity check, but you should be testing the response to ensure correctness.
If the request/response changes then its tests must also change, In the same way when a ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bdd × 142tdd × 54
unit-testing × 35
testing × 31
cucumber × 16
acceptance-testing × 15
specflow × 15
integration-tests × 11
domain-driven-design × 10
agile × 9
design × 8
c# × 8
javascript × 7
development-process × 7
.net × 5
requirements × 5
selenium × 5
java × 4
functional-testing × 4
documentation × 3
node.js × 3
specifications × 3
development-methodologies × 3
architecture × 2
python × 2