/JUnit

JUnit is the main Java library used to write the so-called unit tests, which allow us to quickly know if the code is working as expected, or even if changes in that code have impacted the project in some way.

Primary LanguageJava

TDD and Java: Automated Testing with

  • The importance of writing automated tests in an application
  • Knowing JUnit, the main library for automated tests in Java
  • Writing automated tests with JUnit
  • Using the TDD process when writing automated tests
  • Key JUnit annotations and features

First tests

IMG1:

IMG2:

IMG3:


The implementation with Tdd is based of circle process, see below:

Steps: 1 -> Implement your logic business test, 2 -> Run tests, 3 -> Refactoring and Run Test

The idea is to build the tests first, as we've always seen and we do the opposite, for example, we create the rules to be tested, in this case, we create the tests and then we create the implementation, as if it were test-oriented. In a way, you realize how different this methodology is and yes, it is possible to see the test to be carried out with different eyes.

When implementing your tests, it is also important to use design patterns so that your tests are future-proof and maintain code quality.

finished course