Test Driven Development Flashcards Preview

Software Unit Tests > Test Driven Development > Flashcards

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

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

Write failing tests, make it pass and then refactor.


How much code should be written on TDD?

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


What's TDD?

The continuous iteration of TDD cycle.


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;


What are disadvantages of TDD?

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


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.


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

Define the default namespace in the .Tests project.


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.


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.


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

In the refactor phase.


How to convert a name of a class to string?

By using nameof method.


What is the single responsibility principle?

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


What is the dependency inversion principle?

Components must depend on abstractions and not on implementations.


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

In the DataInterface folder.