Test Driven Development Flashcards Preview

Software Unit Tests > Test Driven Development > Flashcards

Flashcards in Test Driven Development Deck (14)
Loading flashcards...
1

What's the steps of TDD (TDD cycle)?

Write failing tests, make it pass and then refactor.

2

How much code should be written on TDD?

Just enough tests and enough code to make the tests pass. Then some refactor.

3

What's TDD?

The continuous iteration of TDD cycle.

4

What are advantages of TDD?

Think about APIs;
Think about the code should do (not how yet);
Gest fast feedback (not even running the real app);
Decoupled implementation by design (modular code);
Write maintainable code;
Tests are good documentation;

5

What are disadvantages of TDD?

Not so easy to start with the tests. Requires learning curve until be productive.

6

How does a simple .net core app architecture look like?

Four projects in the solution: DeskBooker.Web, DeskBooker.Core, DeskBooker.DataAccess, DeskBooker.Core.Tests, DeskBooker.DataAccess.Tests and DeskBooker.Web.Tests.

7

How to write code in the test project inside the same namespace as the DeskBooker.Core?

Define the default namespace in the .Tests project.

8

How to create real classes from within the tests test project?

By creating the variables and then instantiating new objects with their real name so that you can ctrl + . to generate the class. Also, if you are creating POJOs, you can initialize the POJO with new MyPojo {property = ""} so that visual studio will create the class with the props already created.

9

Which folder the POJOs needs to be stored in the DeskBooker.Core project?

In the domain folder. And the files in this folder should be in the DeskBooker.Core.Domain namespace.

10

When the files generated by the test stage should be moved?

In the refactor phase.

11

How to convert a name of a class to string?

By using nameof method.

12

What is the single responsibility principle?

A class or method should have only one reason to change.

13

What is the dependency inversion principle?

Components must depend on abstractions and not on implementations.

14

Which folder the repository interface needs to be stored in the DeskBooker.Core project?

In the DataInterface folder.